Convert many completions to use _parse_help() instead of hardcoded option lists.

This commit is contained in:
Ville Skyttä 2011-04-28 21:21:31 +03:00
parent 393ab1f650
commit e2c57c5966
26 changed files with 79 additions and 362 deletions

View File

@ -63,13 +63,7 @@ _mock()
$split && return 0
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '--version --help --rebuild --buildsrpm
--shell --chroot --clean --init --installdeps --install --update
--orphanskill --copyin --copyout --root --offline --no-clean
--cleanup-after --no-cleanup-after --arch --target --define --with
--without --resultdir --uniqueext --configdir --rpmbuild_timeout
--unpriv --cwd --spec --sources --verbose --quiet --trace
--enable-plugin --disable-plugin --print-root-path' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
_filedir '@(?(no)src.r|s)pm'
fi

View File

@ -139,11 +139,7 @@ _yum()
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --tolerant -C -c -R -d \
--showduplicates -e --quiet --verbose -y --version --installroot \
--enablerepo --disablerepo --exclude --disableexcludes --obsoletes \
--noplugins --nogpgcheck --disableplugin --enableplugin \
--skip-broken --color' -- $cur ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
} &&

View File

@ -13,8 +13,7 @@ _repomanage()
[[ "$prev" == -@(h|-help|k|-keep) ]] && return 0
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '--old --new --space \
--keep --nocheck --help' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
_filedir -d
fi

View File

@ -30,11 +30,7 @@ _ant()
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-help -projecthelp -version -diagnostics \
-quiet -verbose -debug -emacs -lib -logfile -logger -listener \
-noinput -buildfile -D -keep-going -propertyfile -inputhandler \
-find -s -nice -nouserlib -noclasspath -autoproxy -main' \
-- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
# available targets completion
# find which buildfile to use

View File

@ -58,7 +58,7 @@ _hcitool()
_get_first_arg
if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help -i' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'dev inq scan name info \
spinq epinq cmd con cc dc sr cpt rssi lq tpl \
@ -132,7 +132,7 @@ _sdptool()
_get_first_arg
if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'search browse records add \
del get setattr setseq' -- "$cur" ) )
@ -213,8 +213,7 @@ _rfcomm()
_get_first_arg
if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help -a --raw \
--config -i --auth --encrypt --secure --master' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'show connect listen watch \
bind release' -- "$cur" ) )
@ -253,7 +252,7 @@ _ciptool()
_get_first_arg
if [ -z $arg ]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help -i' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W 'show search connect release \
loopback' -- "$cur" ) )
@ -284,7 +283,7 @@ _dfutool()
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --device' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
local args
_count_args

View File

@ -28,10 +28,7 @@ _configure()
if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' )" \
-- "$cur" ) )
else
COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \
awk '/^ --[A-Za-z]/ { print $1; \
if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' )" \
-- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
fi
} &&
complete -F _configure configure

View File

@ -102,8 +102,9 @@ _id()
_init_completion || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\
-r --real -u --user --help --version' -- "$cur" ) )
local opts=$( _parse_help "$1" )
[[ $opts ]] || opts="-G -g -u" # POSIX fallback
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
else
COMPREPLY=( $( compgen -u "$cur" ) )
fi
@ -133,8 +134,11 @@ _mktemp()
$split && return 0
[[ "$cur" == -* ]] && \
COMPREPLY=( $( compgen -W '-d -u -q -p -t' -- "$cur" ) )
if [[ "$cur" == -* ]]; then
local opts=$( _parse_help "$1" )
[[ $opts ]] || opts="-d -u -q -p -t" # non-GNU fallback
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
fi
} &&
complete -F _mktemp mktemp

View File

@ -29,14 +29,9 @@ _cvs_commands()
cvs --help-commands 2>&1 | awk '/^( *|\t)/ { print $1 }'
}
_cvs_options()
{
cvs --help-options 2>&1 | awk '/^( *|\t)-/ { print $1 }'
}
_cvs_command_options()
{
cvs --help $1 2>&1 | sed -ne 's/^[[:space:]]*\(-[^[:space:]=[]*\).*/\1/p'
COMPREPLY=( $( compgen -W '$( _parse_help "$1" "--help $2" )' -- "$cur" ) )
}
_cvs_kflags()
@ -166,8 +161,7 @@ _cvs()
COMPREPLY=( $( compgen -X '*~' -W '${files[@]}' -- $cur ) )
fi
else
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
-- "$cur" ) )
_cvs_command_options "$1" $mode
fi
;;
admin)
@ -186,16 +180,14 @@ _cvs()
esac
if [[ "$cur" = -* ]]; then
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
-- "$cur" ) )
_cvs_command_options "$1" $mode
fi
;;
annotate)
[[ "$prev" == -@(r|D) ]] && return 0
if [[ "$cur" = -* ]]; then
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
-- "$cur" ) )
_cvs_command_options "$1" $mode
else
get_entries
COMPREPLY=( $( compgen -W '${entries[@]}' -- "$cur" ) )
@ -222,8 +214,7 @@ _cvs()
awk '{print $1}' ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
-- "$cur" ) )
_cvs_command_options "$1" $mode
fi
;;
commit)
@ -258,8 +249,7 @@ _cvs()
COMPREPLY=( $(compgen -o default -- "$cur") )
fi
else
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
-- "$cur" ) )
_cvs_command_options "$1" $mode
fi
;;
cvsroot)
@ -287,8 +277,7 @@ _cvs()
COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
-- "$cur" ) )
_cvs_command_options "$1" $mode
fi
;;
diff)
@ -311,8 +300,7 @@ _cvs()
COMPREPLY=( $(compgen -W '${miss[@]:-}' -- "$cur") )
fi
else
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
-- "$cur" ) )
_cvs_command_options "$1" $mode
fi
;;
import)
@ -339,8 +327,7 @@ _cvs()
pwd=${pwd##*/}
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- $cur ) )
else
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
-- "$cur" ) )
_cvs_command_options "$1" $mode
fi
;;
update)
@ -355,8 +342,7 @@ _cvs()
esac
if [[ "$cur" = -* ]]; then
COMPREPLY=( $( compgen -W "$( _cvs_command_options $mode )" \
-- "$cur" ) )
_cvs_command_options "$1" $mode
fi
;;
"")
@ -374,7 +360,8 @@ _cvs()
;;
esac
COMPREPLY=( $( compgen -W '$( _cvs_commands ) $( _cvs_options ) \
COMPREPLY=( $( compgen -W '$( _cvs_commands ) \
$( _parse_help "$1" --help-options ) \
--help --help-commands --help-options --version' -- "$cur" ) )
;;
esac

View File

@ -50,10 +50,7 @@ _cvsps()
esac
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '-h -x -u -z -g -s -a -f -d -b -l -r -p -v \
-t --norc --summary-first --test-log --diff-opts --bkcvs --no-rlog \
--cvs-direct --no-cvs-direct --debuglvl -Z --root -q -A' \
-- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
else
declare -F _cvs_roots &>/dev/null && _cvs_roots
fi

View File

@ -23,7 +23,7 @@ _dd()
_expand || return 0
COMPREPLY=( $( compgen -W '--help --version' -- "$cur" ) \
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) \
$( compgen -W 'bs cbs conv count ibs if obs of seek skip' \
-S '=' -- "$cur" ) )
} &&

View File

@ -35,10 +35,7 @@ _gkrellm()
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--theme --geometry --wm --m2 --nt \
--withdrawn --config --force-host-config --server --port --nc \
--config-clean --nolock --plugin --demo --logfile --version \
--debug-level --help' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
fi
} &&

View File

@ -29,9 +29,7 @@ _iconv()
$split && return 0
if [[ "$cur" = -* ]]; then
COMPREPLY=( $( compgen -W '--from-code --to-code --list -c
--unicode-subst --byte-subst --widechar-subst --output --silent
--verbose --help --usage --version' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
} &&

View File

@ -21,8 +21,7 @@ _iftop()
;;
esac
COMPREPLY=( $( compgen -W '-h -n -N -p -P -b -B -i -f -F -c -m' \
-- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
} &&
complete -F _iftop iftop

View File

@ -136,46 +136,7 @@ _convert()
_ImageMagick
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \
-adaptive-sharpen -adjoin -affine -alpha -annotate \
-antialias -append -attenuate -authenticate \
-auto-orient -average -background -bench -bias \
-black-point-compensation -black-threshold \
-blue-primary -blur -border -bordercolor -caption \
-channel -charcoal -chop -clip -clip-mask -clip-path \
-clone -clut -coalesce -colorize -colors -colorspace \
-combine -comment -compose -composite -compress \
-contrast -contrast-stretch -convolve -crop -cycle \
-debug -decipher -deconstruct -define -delay -delete \
-density -depth -despeckle -display -dispose -distort \
-dither -draw -edge -emboss -encipher -encoding \
-endian -enhance -equalize -evaluate -extent -extract \
-family -fill -filter -flatten -flip -floodfill -flop \
-font -format -frame -fuzz -fx -gamma -gaussian-blur \
-geometry -gravity -green-primary -help -identify \
-implode -insert -intent -interlace -interpolate \
-label -lat -layers -level -limit -linear-stretch \
-liquid-rescale -list -log -loop -map -mask \
-mattecolor -median -modulate -monitor -monochrome \
-morph -mosaic -motion-blur -negate -noise -normalize \
-opaque -ordered-dither -orient -page -paint -ping \
-pointsize -polaroid -posterize -preview -print \
-process -profile -quality -quantize -quiet \
-radial-blur -raise -random-threshold -recolor \
-red-primary -regard-warnings -region -render -repage \
-resample -resize -respect-parenthesis -reverse -roll \
-rotate -sample -sampling-factor -scale -scene -seed \
-segment -separate -sepia-tone -set -shade -shadow \
-sharpen -shave -shear -sigmoidal-contrast -size \
-sketch -solarize -splice -spread -stretch -strip \
-stroke -strokewidth -style -swap -swirl -taint \
-texture -threshold -thumbnail -tile -tile-offset \
-tint -transform -transparent -transparent-color \
-transpose -transverse -treedepth -trim -type \
-undercolor -unique-colors -units -unsharp -verbose \
-version -view -vignette -virtual-pixel -wave \
-weight -white-point -white-threshold \
-write' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+adjoin +append +compress \
+contrast +debug +dither +endian +gamma +label +map \
@ -195,42 +156,7 @@ _mogrify()
_ImageMagick
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \
-adaptive-sharpen -adjoin -affine -alpha -annotate \
-antialias -attenuate -authenticate -auto-orient \
-background -bias -black-point-compensation \
-black-threshold -blue-primary -blur -border \
-bordercolor -caption -channel -charcoal -chop -clip \
-clip-mask -clip-path -clut -colorize -colors \
-colorspace -comment -compose -compress -contrast \
-contrast-stretch -convolve -cycle -debug -decipher \
-define -delay -density -depth -despeckle -display \
-dispose -distort -dither -draw -edge -emboss \
-encipher -encoding -endian -enhance -equalize \
-evaluate -extent -extract -family -fill -filter \
-flip -floodfill -flop -font -format -frame -fuzz \
-gamma -gaussian-blur -geometry -gravity \
-green-primary -help -identify -implode -intent \
-interlace -interpolate -label -lat -layers -level \
-limit -linear-stretch -liquid-rescale -list -log \
-loop -mask -mattecolor -median -modulate -monitor \
-monochrome -motion-blur -negate -noise -normalize \
-opaque -ordered-dither -orient -page -paint -path \
-ping -pointsize -polaroid -posterize -preview -print \
-profile -quality -quantize -quiet -radial-blur \
-raise -random-threshold -recolor -red-primary \
-regard-warnings -region -render -repage -resample \
-resize -roll -rotate -sample -sampling-factor -scale \
-scene -seed -segment -sepia-tone -set -shade -shadow \
-sharpen -shave -shear -sigmoidal-contrast -size \
-sketch -solarize -splice -spread -stretch -strip \
-stroke -strokewidth -style -swirl -taint -texture \
-threshold -thumbnail -tile -tile-offset -tint \
-transform -transparent -transparent-color -transpose \
-transverse -treedepth -trim -type -undercolor \
-unique-colors -units -unsharp -verbose -version \
-view -vignette -virtual-pixel -wave -weight \
-white-point -white-threshold' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
+endian +gamma +label +map +mask +matte +negate +page \
@ -249,26 +175,7 @@ _display()
_ImageMagick
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \
-auto-orient -backdrop -background -border \
-bordercolor -borderwidth -channel -clip \
-clip-path -coalesce -colormap -colors -colorspace \
-comment -compress -contrast -crop -debug -decipher \
-define -delay -density -depth -despeckle -display \
-dispose -dither -edge -endian -enhance -extract \
-filter -flatten -flip -flop -font -foreground \
-format -frame -gamma -geometry -help -iconGeometry \
-iconic -identify -immutable -interlace -interpolate \
-label -limit -list -log -loop -map -mattecolor \
-monitor -monochrome -name -negate -page -profile \
-quality -quantize -quiet -raise -regard-warnings \
-remote -repage -resample -resize \
-respect-parenthesis -roll -rotate -sample \
-sampling-factor -scenes -seed -segment -set \
-shared-memory -sharpen -size -strip -texture -title \
-transparent-color -treedepth -trim -update \
-usePixmap -verbose -version -virtual-pixel -visual \
-window -window-group -write' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
+endian +gamma +label +map +matte +negate +page \
@ -287,21 +194,7 @@ _animate()
_ImageMagick
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-alpha -authenticate -backdrop \
-background -bordercolor -borderwidth -channel \
-coalesce -colormap -colors -colorspace -crop -debug \
-decipher -define -delay -density -depth -display \
-dispose -dither -extract -filter -flatten -font \
-foreground -format -gamma -geometry -help \
-iconGeometry -iconic -identify -immutable -interlace \
-interpolate -limit -list -log -loop -map -mattecolor \
-mattecolor -monitor -monochrome -name -page -pause \
-quantize -quiet -regard-warnings -remote -repage \
-resample -resize -respect-parenthesis -rotate \
-sampling-factor -scenes -seed -set -shared-memory \
-size -strip -title -transparent-color -treedepth \
-trim -verbose -version -virtual-pixel -visual \
-window' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' \
-- "$cur" ) )
@ -319,13 +212,7 @@ _identify()
_ImageMagick
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \
-channel -colorspace -crop -debug -define -density \
-depth -extract -format -fuzz -gamma -help -interlace \
-interpolate -limit -list -log -monitor -ping -quiet \
-regard-warnings -respect-parenthesis \
-sampling-factor -seed -set -size -strip -units \
-verbose -version -virtual-pixel' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
else
@ -342,25 +229,7 @@ _montage()
_ImageMagick
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-adjoin -affine -alpha \
-authenticate -background -blue-primary -blur -border \
-bordercolor -borderwidth -caption -channel -clone \
-coalesce -colors -colorspace -comment -compose \
-compress -crop -debug -define -density -depth \
-display -dispose -dither -draw -encoding -endian \
-extract -fill -filter -flatten -flip -flop -font \
-format -frame -gamma -geometry -gravity \
-green-primary -help -identify -interlace \
-interpolate -label -limit -list -log -mattecolor \
-mode -monitor -monochrome -origin -page -pointsize \
-polaroid -profile -quality -quantize -quiet \
-red-primary -regard-warnings -repage -resize \
-respect-parenthesis -rotate -sampling-factor -scenes \
-seed -set -shadow -size -strip -stroke -texture \
-thumbnail -tile -title -transform -transparent \
-transparent-color -treedepth -trim -type -units \
-verbose -version -virtual-pixel \
-white-point' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither \
+endian +gamma +label +matte +page' -- "$cur" ) )
@ -378,22 +247,7 @@ _composite()
_ImageMagick
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-affine -alpha -authenticate \
-blend -blue-primary -border -bordercolor -channel \
-colors -colorspace -comment -compose -compress \
-debug -decipher -define -density -depth -displace \
-display -dispose -dissolve -dither -encipher \
-encoding -endian -extract -filter -font -format \
-geometry -gravity -green-primary -help -identify \
-interlace -interpolate -label -limit -list -log \
-monitor -monochrome -negate -page -profile -quality \
-quantize -quiet -red-primary -regard-warnings \
-repage -resize -respect-parenthesis -rotate \
-sampling-factor -scene -seed -sharpen -shave -size \
-stegano -stereo -strip -swap -thumbnail -tile \
-transform -transparent-color -treedepth -type -units \
-unsharp -verbose -version -virtual-pixel -watermark \
-white-point -write' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label \
+matte +negate +page +write' -- "$cur" ) )
@ -411,15 +265,7 @@ _compare()
_ImageMagick
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-alpha -authenticate -channel \
-colorspace -compress -debug -decipher -define \
-density -depth -encipher -extract -format -fuzz \
-help -highlight-color -identify -interlace -limit \
-list -log -metric -monitor -passphrase -profile \
-quality -quantize -quiet -regard-warnings \
-respect-parenthesis -sampling-factor -seed -set \
-size -transparent-color -type -verbose -version \
-virtual-pixel' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
else
@ -436,8 +282,7 @@ _conjure()
_ImageMagick
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-debug -help -list -log -monitor -quiet \
-regard-warnings -seed -verbose -version' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
else
@ -454,19 +299,7 @@ _import()
_ImageMagick
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-adjoin -annotate -border -channel \
-colors -colorspace -comment -compress -crop -debug \
-define -delay -density -depth -descend -display \
-dispose -dither -encipher -encoding -endian -filter \
-format -frame -geometry -gravity -help -identify \
-interlace -interpolate -label -limit -list -log \
-monitor -monochrome -negate -page -pause -pointsize \
-quality -quantize -quiet -regard-warnings -repage \
-resize -respect-parenthesis -rotate -sampling-factor \
-scene -screen -seed -set -silent -snaps -strip \
-thumbnail -transparent -transparent-color -treedepth \
-trim -type -verbose -version -virtual-pixel \
-window' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
else
@ -483,13 +316,7 @@ _stream()
_ImageMagick
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-authenticate -channel -colorspace \
-compress -debug -define -density -depth -extract \
-help -identify -interlace -interpolate -limit -list \
-log -map -monitor -quantize -quiet -regard-warnings \
-respect-parenthesis -sampling-factor -seed -set \
-size -storage-type -transparent-color -verbose \
-version -virtual-pixel' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
elif [[ "$cur" == +* ]]; then
COMPREPLY=( $( compgen -W '+debug' -- "$cur" ) )
else

View File

@ -215,11 +215,7 @@ _java()
esac
if [[ "$cur" == -* ]]; then
# standard options
COMPREPLY=( $( compgen -W '-client -server -agentlib: -agentpath:
-classpath -D -d32 -d64 -enableassertions -disableassertions
-enablesystemassertions -disablesystemassertions -jar -javaagent:
-verbose -verbose -version -showversion -help -X' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
else
if [[ "$prev" == -jar ]]; then
# jar file completion
@ -263,20 +259,7 @@ _javadoc()
esac
if [[ "$cur" == -* ]]; then
# relevant options completion
COMPREPLY=( $( compgen -W '-overview -public -protected \
-package -private -help -doclet -docletpath \
-sourcepath -classpath -exclude -subpackages \
-breakiterator -bootclasspath -source -extdirs \
-verbose -locale -encoding -J -d -use -version \
-author -docfilessubdirs -splitindex \
-windowtitle -doctitle -header -footer -bottom \
-link -linkoffline -excludedocfilessubdir \
-group -nocomment -nodeprecated -noqualifier \
-nosince -nodeprecatedlist -notree -noindex \
-nohelp -nonavbar -quiet -serialwarn -tag \
-taglet -tagletpath -charset -helpfile \
-linksource -stylesheetfile -docencoding' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
else
# source files completion
_filedir java
@ -304,11 +287,7 @@ _javac()
esac
if [[ "$cur" == -* ]]; then
# relevant options completion
COMPREPLY=( $( compgen -W '-g -g:none -g:lines -g:vars \
-g:source -O -nowarn -verbose -deprecation -classpath \
-sourcepath -bootclasspath -extdirs -d -encoding -source \
-target -help' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
else
# source files completion
_filedir java

View File

@ -17,8 +17,7 @@ _lftp()
esac
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '-f -c --help --version -e -u -p' \
-- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi

View File

@ -8,8 +8,7 @@ _lrzip()
_init_completion || return
if [[ "$cur" == -* && $prev != -N ]]; then
COMPREPLY=( $( compgen -W '-w -d -o -O -S -f -D -q -L -n -l -b -g -M \
-T -N -v -vv -V -h' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi

View File

@ -25,8 +25,7 @@ _mii_tool()
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--verbose --version --reset --restart \
--watch --log --advertise --force' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
_available_interfaces -a
fi
@ -54,10 +53,7 @@ _mii_diag()
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--advertise --fixed-speed --all-interfaces \
--status --debug --read-parameters --set-parameters --msg-level \
--phy --restart --reset --verbose --version --watch --help' \
-- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
_available_interfaces -a
fi

View File

@ -25,16 +25,7 @@ _pkg_config()
$split && return 0
if [[ "$cur" == -* ]]; then
# return list of available options
COMPREPLY=( $( compgen -W '--version --modversion \
--atleast-pkgconfig-version --libs --static \
--short-errors --libs-only-l --libs-only-other \
--libs-only-L --cflags --cflags-only-I \
--cflags-only-other --variable --define-variable \
--exists --uninstalled --atleast-version \
--exact-version --max-version --list-all --debug \
--print-errors --silence-errors --errors-to-stdout \
--print-provides --print-requires --help --usage' -- "$cur") )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W "$( pkg-config --list-all \
2>/dev/null | awk '{print $1}' )" -- "$cur" ) )

View File

@ -14,7 +14,7 @@ _reptyr()
esac
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '-l -s' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi

View File

@ -27,8 +27,7 @@ _rtcwake()
$split && return 0
COMPREPLY=( $( compgen -W '--device --local --mode --seconds --time --utc \
--verbose --version --help' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
} &&
complete -F _rtcwake rtcwake

View File

@ -40,11 +40,7 @@ _useradd()
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--base-dir --comment --home-dir --defaults \
--expiredate --inactive --gid --groups --help --skel --key \
--no-log-init --create-home --no-create-home --no-user-group \
--non-unique --password --system --shell --uid --user-group \
--selinux-user' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
} &&
@ -87,10 +83,7 @@ _usermod()
if [[ "$cur" == -* ]]; then
# TODO: -U/--unlock, -p/--password, -L/--lock mutually exclusive
COMPREPLY=( $( compgen -W '--append --comment --home --expiredate \
--inactive --gid --groups --help --login --lock --move-home \
--non-unique --password --shell --uid --unlock --selinux-user' \
-- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
@ -105,7 +98,7 @@ _userdel()
_init_completion || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--force --help --remove' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
@ -132,8 +125,7 @@ _chage()
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--lastday --expiredate --help --inactive \
--list --mindays --maxdays --warndays' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
@ -186,8 +178,7 @@ _chpasswd()
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--crypt-method --encrypted \
--help --md5 --sha-rounds' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
} &&
@ -216,8 +207,7 @@ _newusers()
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--crypt-method --help --system \
--sha-rounds' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
@ -261,8 +251,7 @@ _groupadd()
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--force --gid --help \
--key --non-unique --password --system' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
} &&
@ -289,8 +278,7 @@ _groupmod()
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--gid --help --new-name \
--non-unique --password' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
@ -321,14 +309,15 @@ _gpasswd()
_init_completion || return
case $prev in
-a|-d|-A|-M)
-a|--add|-d|--delete|-A|--administrators|-M|--members)
COMPREPLY=( $( compgen -u -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a -d -r -R -A -M' -- "$cur" ) )
# TODO: only -A and -M can be combined
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
@ -343,18 +332,18 @@ _groupmems()
_init_completion || return
case $prev in
-a|-d)
-a|--add|-d|--delete)
COMPREPLY=( $( compgen -u -- "$cur" ) )
return 0
;;
-g)
-g|--group)
COMPREPLY=( $( compgen -g -- "$cur" ) )
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a -d -p -g -l' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
} &&
@ -388,8 +377,7 @@ _vipw()
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--group --help --passwd \
--quiet --shadow' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
} &&
@ -417,8 +405,7 @@ _faillog()
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--all --help --lock-time \
--maximum --reset --time --user' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
} &&
@ -446,7 +433,7 @@ _lastlog()
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--before --help --time --user' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
} &&

View File

@ -31,8 +31,7 @@ _wol()
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--help --version --verbose --wait --host
--port --file --passwd' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi

View File

@ -18,9 +18,7 @@ _xrdb()
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-help -display -all -global -screen -screens
-n -quiet -cpp -nocpp -symbols -query -load -override -merge
-remove -retain -edit -backup' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi

View File

@ -10,12 +10,8 @@ _xz()
_split_longopt && split=true
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--compress --decompress --test --list \
--keep --force --stdout --no-sparse --suffix --files --files0 \
--format --check -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 --extreme --memory \
--lzma1 --lzma2 --x86 --powerpc --ia64 --arm --armthumb --sparc \
--delta --quiet --verbose --no-warn --robot --info-memory --help \
--long-help --version' -- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" --long-help ) {-1..-9}' \
-- "$cur" ) )
return 0
fi
@ -67,8 +63,7 @@ _xzdec()
_init_completion -n = || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--memory --quiet --help --version' \
-- "$cur" ) )
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi

View File

@ -17,22 +17,7 @@ assert_complete_any "display "
sync_after_int
set test "- should complete options"
set options {
-alpha -antialias -authenticate -auto-orient -backdrop -background -border
-bordercolor -borderwidth -channel -clip -clip-path -coalesce -colormap
-colors -colorspace -comment -compress -contrast -crop -debug -decipher
-define -delay -density -depth -despeckle -display -dispose -dither -edge
-endian -enhance -extract -filter -flatten -flip -flop -font -foreground
-format -frame -gamma -geometry -help -iconGeometry -iconic -identify
-immutable -interlace -interpolate -label -limit -list -log -loop -map
-mattecolor -monitor -monochrome -name -negate -page -profile -quality
-quantize -quiet -raise -regard-warnings -remote -repage -resample -resize
-respect-parenthesis -roll -rotate -sample -sampling-factor -scenes -seed
-segment -set -shared-memory -sharpen -size -strip -texture -title
-transparent-color -treedepth -trim -update -usePixmap -verbose -version
-virtual-pixel -visual -window -window-group -write }
assert_complete $options "display -" $test
assert_complete_any "display -"
sync_after_int