Convert more completions to use _parse_help() instead of hardcoded option lists.
This commit is contained in:
parent
4ea93b286e
commit
4f35919e69
@ -22,13 +22,7 @@ _cpan2dist()
|
||||
esac
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '--help --skiptest --force --install \
|
||||
--verbose --keepsource --makefile --buildprereq \
|
||||
--archive --flushcache --defaults --edit-metafile \
|
||||
--format --ban --banlist --ignore --ignorelist \
|
||||
--modulelist --logfile --timeout --set-config \
|
||||
--set-program --dist-opts --default-banlist \
|
||||
--default-ignorelist' -- $cur ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
else
|
||||
local cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" )
|
||||
local packagelist
|
||||
|
@ -35,10 +35,7 @@ _cryptsetup()
|
||||
_get_first_arg
|
||||
if [ -z $arg ]; then
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '--hash --cipher --verify-passphrase \
|
||||
--key-file --master-key-file --key-slot --key-size --size \
|
||||
--offset --skip --readonly --iter-time --batch-mode --timeout \
|
||||
--tries --align-payload --version' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
else
|
||||
COMPREPLY=( $( compgen -W 'create remove status resize luksFormat \
|
||||
luksOpen luksClose luksSuspend luksResume luksAddKey \
|
||||
|
@ -38,14 +38,7 @@ _dict()
|
||||
done
|
||||
|
||||
if [[ "$cur" = -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '--host --port --database \
|
||||
--match --strategy --config \
|
||||
--nocorrect --dbs --strats \
|
||||
--serverhelp --info --serverinfo \
|
||||
--noauth --user --key --version \
|
||||
--license --help --verbose --raw \
|
||||
--pager --debug --html --pipesize --client' \
|
||||
-- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
@ -61,31 +61,7 @@ _dpkg()
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \
|
||||
--configure -r --remove -P --purge --get-selections \
|
||||
--set-selections --update-avail --merge-avail \
|
||||
--clear-avail --command-fd --forget-old-unavail -s \
|
||||
--status -p --print-avail -L --listfiles -l --list \
|
||||
-S --search -C --audit --print-architecture \
|
||||
--print-gnu-build-architecture \
|
||||
--print-installation-architecture \
|
||||
--compare-versions --help --version --force-help \
|
||||
--force-all --force-auto-select --force-downgrade \
|
||||
--force-configure-any --force-hold --force-bad-path \
|
||||
--force-not-root --force-overwrite \
|
||||
--force-overwrite-diverted --force-bad-verify \
|
||||
--force-depends-version --force-depends \
|
||||
--force-confnew --force-confold --force-confdef \
|
||||
--force-confmiss --force-conflicts --force-architecture\
|
||||
--force-overwrite-dir --force-remove-reinstreq \
|
||||
--force-remove-essential -Dh \
|
||||
--debug=help --licence --admindir --root --instdir \
|
||||
-O --selected-only -E --skip-same-version \
|
||||
-G --refuse-downgrade -B --auto-deconfigure \
|
||||
--no-debsig --no-act -D --debug --status-fd \
|
||||
-b --build -I --info -f --field -c --contents \
|
||||
-x --extract -X --vextract --fsys-tarfile -e --control \
|
||||
--ignore-depends --abort-after' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -27,17 +27,7 @@ _hping2()
|
||||
esac
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '--help --version --count --interval --fast \
|
||||
--faster --numeric --quiet --interface --verbose --debug --bind \
|
||||
--unbind --rawip --icmp --upd --scan --listen --spoof \
|
||||
--rand-source --rand-dest --ttl --id --ipproto --winid -rel --frag \
|
||||
--morefrag --dontfrag --fragoff --mtu --tos --rroute --icmptype \
|
||||
--icmpcode --icmp-ipver --icmp-iphlen --icmp-iplen --icmp-ipid \
|
||||
--icmp-ipproto --icmp-cksum --icmp-ts --icmp-addr --baseport \
|
||||
--destport --keep --win --tcpoff --tcpseq --tcpack --seqnum \
|
||||
--badcksum --tcp-timestamp --fin --syn --rst --push --ack --urg \
|
||||
--xmas --ymas --data --file --sign --dump --print --safe --end \
|
||||
--traceroute --tr-keep-ttl --tr-stop --tr-no-rtt' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
else
|
||||
_known_hosts_real "$cur"
|
||||
fi
|
||||
|
@ -28,10 +28,7 @@ _mc()
|
||||
$split && return 0
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '--stickchars --nocolor --color --colors \
|
||||
--nomouse --edit --datadir --resetsoft --ftplog --printwd --slow \
|
||||
--termcap --nosubshell --subshell --view --version --xterm \
|
||||
--debuglevel --help' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
else
|
||||
_filedir -d
|
||||
fi
|
||||
|
@ -47,15 +47,7 @@ _mcrypt()
|
||||
esac
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '--openpgp --openpgp-z \
|
||||
--decrypt --keysize --keymode --keyfile \
|
||||
--config --algorithm --algorithms-directory \
|
||||
--mode --modes-directory --hash --key \
|
||||
--noiv --bare --gzip --bzip2 --flush \
|
||||
--doublecheck --unlink --nodelete --time \
|
||||
--force --echo --random --list --list-keymodes \
|
||||
--list-hash --verbose --quiet --help \
|
||||
--version --license' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
elif [[ ${words[0]} == mdecrypt ]]; then
|
||||
_filedir nc
|
||||
else
|
||||
|
@ -18,8 +18,7 @@ _munin_run()
|
||||
esac
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '--config --servicedir --sconfdir \
|
||||
--sconffile --help --debug --version' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
else
|
||||
COMPREPLY=( $( compgen -W '$( command ls /etc/munin/plugins )' \
|
||||
-- "$cur" ) )
|
||||
@ -89,9 +88,7 @@ _munin_node_configure()
|
||||
esac
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '--help --version --debug --config \
|
||||
--servicedir --libdir --families --suggest --shell \
|
||||
--remove-also --snmp --snmpversion --snmpcommunity' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
fi
|
||||
} &&
|
||||
complete -F _munin_node_configure munin-node-configure
|
||||
|
@ -45,14 +45,7 @@ _mysqladmin()
|
||||
|
||||
$split && return 0
|
||||
|
||||
COMPREPLY=( $( compgen -W '--count --debug-check --debug-info --force \
|
||||
--compress --character-sets-dir --default-character-set --help --host \
|
||||
--no-beep --password --port --protocol --relative --set-variable \
|
||||
--silent --socket --sleep --ssl --ssl-ca --ssl-capath --ssl-cert \
|
||||
--ssl-cipher --ssl-key --ssl-verify-server-cert --user --verbose \
|
||||
--version --vertical --wait --connect_timeout --shutdown_timeout \
|
||||
--print-defaults --no-defaults --defaults-file --defaults-extra-file' \
|
||||
-- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
|
||||
COMPREPLY+=( \
|
||||
$( compgen -W 'create debug drop extended-status flush-hosts \
|
||||
|
@ -50,9 +50,7 @@ _createdb()
|
||||
$split && return 0
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '--tablespace --template --encoding --host \
|
||||
--port --username --password --echo --quiet --help --version' \
|
||||
-- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
else
|
||||
_pg_databases
|
||||
fi
|
||||
@ -87,8 +85,7 @@ _dropdb()
|
||||
$split && return 0
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '--host --port --username --password \
|
||||
--interactive --echo --quiet --help --version' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
else
|
||||
_pg_databases
|
||||
fi
|
||||
@ -137,12 +134,7 @@ _psql()
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
# return list of available options
|
||||
COMPREPLY=( $( compgen -W '--echo-all --no-align --command --dbname \
|
||||
--echo-queries --echo-hidden --file --field-separator --host \
|
||||
--html --list --log-file --output --port --pset --quiet \
|
||||
--record-separator --single-step --single-line --tuples-only \
|
||||
--table-attr --username --set --version --password --expanded \
|
||||
--no-psqlrc --single-transaction --help' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
else
|
||||
# return list of available databases
|
||||
_pg_databases
|
||||
|
@ -23,9 +23,7 @@ _wvdial()
|
||||
|
||||
case $cur in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W '--config --chat \
|
||||
--remotename --help --version --no-syslog' \
|
||||
-- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||
;;
|
||||
*)
|
||||
# start with global and personal config files
|
||||
|
Loading…
x
Reference in New Issue
Block a user