| 1 |
_newgrp_module() |
| 2 |
{ |
| 3 |
local cur prev OPTS |
| 4 |
COMPREPLY=() |
| 5 |
cur="${COMP_WORDS[COMP_CWORD]}" |
| 6 |
prev="${COMP_WORDS[COMP_CWORD-1]}" |
| 7 |
case $prev in |
| 8 |
'-h'|'--help'|'-V'|'--version') |
| 9 |
return 0 |
| 10 |
;; |
| 11 |
'-c'|'--command') |
| 12 |
COMPREPLY=( $(compgen -c -- $cur) ) |
| 13 |
return 0 |
| 14 |
;; |
| 15 |
esac |
| 16 |
case $cur in |
| 17 |
-*) |
| 18 |
OPTS="--version --help --command" |
| 19 |
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| 20 |
return 0 |
| 21 |
;; |
| 22 |
esac |
| 23 |
if (( COMP_CWORD == 1 )) || [[ " ${COMP_WORDS[@]}" =~ " "-?-c ]]; then |
| 24 |
COMPREPLY=( $(compgen -g -- $cur) ) |
| 25 |
else |
| 26 |
COMPREPLY=( $(compgen -c -- $cur) ) |
| 27 |
fi |
| 28 |
return 0 |
| 29 |
} |
| 30 |
complete -F _newgrp_module newgrp |