| 1 |
# bash completion for dhcpoptinj |
| 2 |
|
| 3 |
_dhcpoptinj() |
| 4 |
{ |
| 5 |
local cur prev words cword split |
| 6 |
_init_completion -s || return |
| 7 |
|
| 8 |
case $prev in |
| 9 |
-h|--help|-v|--version) |
| 10 |
return |
| 11 |
;; |
| 12 |
-c|--conf-file) |
| 13 |
_filedir 'conf' |
| 14 |
return |
| 15 |
;; |
| 16 |
esac |
| 17 |
|
| 18 |
if [[ "$cur" == -* ]]; then |
| 19 |
# _parse_help returns a slightly inconsistent mix of short and long |
| 20 |
# options since some options are mentioned several times in the help |
| 21 |
# text. We can forgive this. Rather use this help function than having |
| 22 |
# to implement the extra code: |
| 23 |
COMPREPLY=( $(compgen -W '$(_parse_help "$1")' -- "$cur") ) |
| 24 |
[[ $COMPREPLY == *= ]] && compopt -o nospace |
| 25 |
return 0 |
| 26 |
fi |
| 27 |
} && complete -F _dhcpoptinj dhcpoptinj |
| 28 |
|
| 29 |
# ex: ts=4 sw=4 filetype=sh expandtab |