PageRenderTime 9ms CodeModel.GetById 6ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion.d/lilo

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