PageRenderTime 84ms CodeModel.GetById 82ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion_lib/complete/lilo

http://github.com/brinkman83/bashrc
#! | 57 lines | 48 code | 9 blank | 0 comment | 0 complexity | 3565d92bc256e37a0e95326d18e02cc8 MD5 | raw file
 1# lilo(8) completion
 2#
 3comp_include _filedir _get_cword
 4
 5
 6_lilo_labels()
 7{
 8    COMPREPLY=( $( awk -F'=' '/label/ {print $2}' \
 9        /etc/lilo.conf | sed -e 's/"//g' | grep "^$cur" ) )
10}
11
12
13_lilo()
14{
15    local cur prev
16
17    COMPREPLY=()
18    cur=`_get_cword`
19    prev=${COMP_WORDS[COMP_CWORD-1]}
20
21    case $prev in
22        -@(C|i|m|s|S))
23            _filedir
24            return 0
25            ;;
26        -r)
27            _filedir -d
28            return 0
29            ;;
30        -@(I|D|R))
31            # label completion
32            _lilo_labels
33            return 0
34            ;;
35        -@(A|b|M|u|U))
36            # device completion
37            cur=${cur:=/dev/}
38            _filedir
39            return 0
40            ;;
41        -T)
42            # topic completion
43            COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \
44                    table= video' -- $cur ) )
45            return 0
46            ;;
47    esac
48
49    if [[ "$cur" == -* ]]; then
50        # relevant options completion
51        COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \
52            -M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- \
53            $cur ) )
54    fi
55} # _lilo()
56
57