Skip to content

Commit

Permalink
f*: Support completing arg of last bundled short option
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Mar 31, 2018
1 parent 008a407 commit c1dfa0f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions completions/faillog
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ _faillog()
_init_completion -s || return

case $prev in
-h|--help|-l|--lock-time|-m|--maximum|-t|--time)
--help|--lock-time|--maximum|--time|-!(-*)[hlmt])
return
;;
-u|--user)
--user|-!(-*)u)
COMPREPLY=( $( compgen -u -- "$cur" ) )
return
;;
Expand Down
26 changes: 13 additions & 13 deletions completions/feh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ _feh()
_init_completion -s || return

case "$prev" in
-B|--image-bg)
--image-bg|-B)
COMPREPLY=( $( compgen -W 'checks white black' -- "$cur" ) )
return
;;
-f|--filelist|-o|--output|-O|--output-only|-\||--start-at)
--filelist|--output|--output-only|--start-at|-!(-*)[foO\|])
_filedir
return
;;
-K|--caption-path|-C|--fontpath|-j|--output-dir)
--caption-path|--fontpath|--output-dir|-!(-*)[KCj])
_filedir -d
return
;;
-e|--font|-M|--menu-font|-@|--title-font)
--font|--menu-font|--title-font|-!(-*)[eM@])
# expect string like "dejavu.ttf/12"
if [[ "$cur" == */* ]]; then # expect integer value
COMPREPLY=( $( compgen -P "$cur" -W '{0..9}' ) )
Expand All @@ -39,7 +39,7 @@ _feh()
compopt -o nospace
return
;;
-T|--theme)
--theme|-!(-*)T)
local conf_path=~/.config/feh/themes
local theme_name theme_opts
[[ -r $conf_path ]] || return
Expand All @@ -51,13 +51,13 @@ _feh()
done < "$conf_path"
return
;;
-S|--sort)
--sort|-!(-*)S)
COMPREPLY=( $( compgen -W 'name filename mtime width height
pixels size format' -- "$cur" ) )
return
;;
-R|--reload|-H|--limit-height|-W|--limit-width|-E|--thumb-height|\
-y|--thumb-width|-J|--thumb-redraw|--magick-timeout)
--reload|--limit-height|--limit-width|--thumb-height|--thumb-width|\
--thumb-redraw|--magick-timeout|-!(-*)[RHWEyJ])
# expect integer value
COMPREPLY+=( $( compgen -W '{0..9}' ) )
compopt -o nospace
Expand All @@ -72,16 +72,16 @@ _feh()
fi
return
;;
-a|--alpha)
--alpha|-!(-*)a)
COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) )
return
;;
-b|--bg)
--bg|-!(-*)b)
_filedir
COMPREPLY+=( $( compgen -W 'trans' -- "$cur" ) )
return
;;
-g|--geometry|--max-dimension|--min-dimension)
--geometry|--max-dimension|--min-dimension|-!(-*)g)
# expect string like 640x480
if [[ $cur && "$cur" != *x* ]]; then
COMPREPLY=( x )
Expand All @@ -90,8 +90,8 @@ _feh()
compopt -o nospace
return
;;
-L|--customlist|--index-info|--info|-D|--slideshow-delay|-~|\
--thumb-title|-^|--title)
--customlist|--index-info|--info|--slideshow-delay|--thumb-title|\
--title|-!(-*)[LD~^])
# argument required but no completions available
return
;;
Expand Down
6 changes: 3 additions & 3 deletions completions/file
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ _file()
_init_completion || return

case $prev in
--help|-v|--version|-F|--separator)
--help|--version|--separator|-!(-*)[vF])
return
;;
-m|--magic-file|-f|--files-from)
--magic-file|--files-from|-!(-*)[mf])
_filedir
return
;;
-e|--exclude)
--exclude|-!(-*)e)
COMPREPLY=( $( compgen -W 'apptype ascii cdf compress elf encoding
soft tar text tokens troff' -- "$cur" ) )
return
Expand Down
6 changes: 3 additions & 3 deletions completions/file-roller
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ _file_roller()
local exts='@(7z|ace|alz|ar|arj|[bglx]z|bz2|tb?(z)2|cab|cb[rz]|iso?(9660)|Z|t[abglx]z|cpio|deb|rar|?(g)tar|gem|lh[az]|lz[4h]|?(t)lrz|lzma|lzo|wim|swm|rpm|sit|zoo)'

case $prev in
-'?'|--help|--help-all|--help-gtk|--help-sm-client)
--help|--help-all|--help-gtk|--help-sm-client|-!(-*)'?')
return
;;
--sm-client-state-file)
_filedir
return
;;
-a|--add-to)
--add-to|-!(-*)a)
_filedir_xspec unzip
_filedir "$exts"
return
;;
-e|--extract-to|--default-dir)
--extract-to|--default-dir|-!(-*)e)
_filedir -d
return
;;
Expand Down
4 changes: 2 additions & 2 deletions completions/flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ _flake8()
_init_completion -s || return

case $prev in
-h|--help|--version)
--help|--version|-!(-*)h)
return
;;
--format)
COMPREPLY=( $( compgen -W 'default pylint' -- "$cur" ) )
return
;;
-j|--jobs)
--jobs|-!(-*)j)
COMPREPLY=( $( compgen -W "auto {1..$(_ncpus)}" -- "$cur" ) )
return
;;
Expand Down
4 changes: 2 additions & 2 deletions completions/fusermount
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ _fusermount()
_init_completion || return

case $prev in
-h|-V|-o)
-*[hVo])
return
;;
-u)
-*u)
COMPREPLY=( $( compgen -W "$( awk \
'{ if ($3 ~ /^fuse(\.|$)/) print $2 }' /etc/mtab \
2>/dev/null )" -- "$cur" ) )
Expand Down

0 comments on commit c1dfa0f

Please sign in to comment.