Skip to content

Commit

Permalink
g*: Support completing arg of last bundled short option
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Apr 1, 2018
1 parent c1dfa0f commit e00c119
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions completions/getent
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ _getent()
local i db
for (( i=1; i < cword; i++ )); do
case ${words[i]} in
-V|--version|--usage|-'?'|--help)
--version|--usage|--help|-!(-*)[V?])
return
;;
-s|--service)
--service|-!(-*)s)
(( i++ ))
;;
-*)
Expand Down
2 changes: 1 addition & 1 deletion completions/gpasswd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ _gpasswd()
_init_completion || return

case $prev in
-a|--add|-d|--delete|-A|--administrators|-M|--members)
--add|--delete|--administrators|--members|-!(-*)[adAM])
COMPREPLY=( $( compgen -u -- "$cur" ) )
return
;;
Expand Down
4 changes: 2 additions & 2 deletions completions/gpg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ _gpg()
_init_completion || return

case $prev in
-s|--sign|--clearsign|--decrypt-files|--load-extension)
--sign|--clearsign|--decrypt-files|--load-extension|-!(-*)s)
_filedir
return
;;
Expand All @@ -17,7 +17,7 @@ _gpg()
's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) )
return
;;
-r|--recipient)
--recipient|-!(-*)r)
COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | command sed -ne \
's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ) )
if [[ -e ~/.gnupg/gpg.conf ]]; then
Expand Down
4 changes: 2 additions & 2 deletions completions/gpg2
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _gpg2()
_filedir -d
return
;;
-s|--sign|--clearsign|--options|--decrypt)
--sign|--clearsign|--options|--decrypt|-!(-*)s)
_filedir
return
;;
Expand All @@ -21,7 +21,7 @@ _gpg2()
's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) )
return
;;
-r|--recipient)
--recipient|-!(-*)r)
COMPREPLY=( $( compgen -W "$( $1 --list-keys 2>/dev/null | \
command sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ) )
if [[ -e ~/.gnupg/gpg.conf ]]; then
Expand Down
2 changes: 1 addition & 1 deletion completions/groupadd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ _groupadd()
# with -g/--gid

case $prev in
-g|--gid|-K|--key|-p|--password)
--gid|--key|--password|-!(-*)[gKp])
return
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion completions/groupmod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ _groupmod()
# with -g/--gid

case $prev in
-g|--gid|-h|--help|-n|--new-name|-p|--password)
--gid|--help|--new-name|--password|-!(-*)[ghnp])
return
;;
esac
Expand Down
4 changes: 2 additions & 2 deletions completions/gzip
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ _gzip()
_init_completion || return

case $prev in
-b|--blocksize|-S|--suffix|-h|--help|-V|--version)
--blocksize|--suffix|--help|--version|-!(-*)[bShV])
return
;;
-p|--processes)
--processes|-!(-*)p)
COMPREPLY=( $( compgen -W "{1..$(_ncpus)}" -- "$cur" ) )
return
;;
Expand Down

0 comments on commit e00c119

Please sign in to comment.