1 # completion for bitfield program
3 bitfield --list | awk '{print $1}'
10 cur=${COMP_WORDS[COMP_CWORD]}
11 prev=${COMP_WORDS[COMP_CWORD-1]}
13 # help, search, list: no completions
14 if [[ "$prev" == '-h' || "$prev" == '-s' || "$prev" == '-l' ]]
19 opts="--help --search --list --non-zero"
21 # complete -* with long options.
24 COMPREPLY=($(compgen -W "$opts" -- $cur))
28 # first parameter on line - complete with options + list of bitfields
29 # FIXME: presence of -n will disable this...
30 if [ $COMP_CWORD -eq 1 ]
32 COMPREPLY=($(compgen -W "$opts $(_bitfield_list)" -- $cur))
37 complete -F _bitfield filenames bitfield