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
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--help --skiptest --force --install \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--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 ) )
|
|
||||||
else
|
else
|
||||||
local cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" )
|
local cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" )
|
||||||
local packagelist
|
local packagelist
|
||||||
|
@ -35,10 +35,7 @@ _cryptsetup()
|
|||||||
_get_first_arg
|
_get_first_arg
|
||||||
if [ -z $arg ]; then
|
if [ -z $arg ]; then
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--hash --cipher --verify-passphrase \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--key-file --master-key-file --key-slot --key-size --size \
|
|
||||||
--offset --skip --readonly --iter-time --batch-mode --timeout \
|
|
||||||
--tries --align-payload --version' -- "$cur" ) )
|
|
||||||
else
|
else
|
||||||
COMPREPLY=( $( compgen -W 'create remove status resize luksFormat \
|
COMPREPLY=( $( compgen -W 'create remove status resize luksFormat \
|
||||||
luksOpen luksClose luksSuspend luksResume luksAddKey \
|
luksOpen luksClose luksSuspend luksResume luksAddKey \
|
||||||
|
@ -38,14 +38,7 @@ _dict()
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [[ "$cur" = -* ]]; then
|
if [[ "$cur" = -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--host --port --database \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--match --strategy --config \
|
|
||||||
--nocorrect --dbs --strats \
|
|
||||||
--serverhelp --info --serverinfo \
|
|
||||||
--noauth --user --key --version \
|
|
||||||
--license --help --verbose --raw \
|
|
||||||
--pager --debug --html --pipesize --client' \
|
|
||||||
-- "$cur" ) )
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -61,31 +61,7 @@ _dpkg()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--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" ) )
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -27,17 +27,7 @@ _hping2()
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--help --version --count --interval --fast \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--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" ) )
|
|
||||||
else
|
else
|
||||||
_known_hosts_real "$cur"
|
_known_hosts_real "$cur"
|
||||||
fi
|
fi
|
||||||
|
@ -28,10 +28,7 @@ _mc()
|
|||||||
$split && return 0
|
$split && return 0
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--stickchars --nocolor --color --colors \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--nomouse --edit --datadir --resetsoft --ftplog --printwd --slow \
|
|
||||||
--termcap --nosubshell --subshell --view --version --xterm \
|
|
||||||
--debuglevel --help' -- "$cur" ) )
|
|
||||||
else
|
else
|
||||||
_filedir -d
|
_filedir -d
|
||||||
fi
|
fi
|
||||||
|
@ -47,15 +47,7 @@ _mcrypt()
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--openpgp --openpgp-z \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--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" ) )
|
|
||||||
elif [[ ${words[0]} == mdecrypt ]]; then
|
elif [[ ${words[0]} == mdecrypt ]]; then
|
||||||
_filedir nc
|
_filedir nc
|
||||||
else
|
else
|
||||||
|
@ -18,8 +18,7 @@ _munin_run()
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--config --servicedir --sconfdir \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--sconffile --help --debug --version' -- "$cur" ) )
|
|
||||||
else
|
else
|
||||||
COMPREPLY=( $( compgen -W '$( command ls /etc/munin/plugins )' \
|
COMPREPLY=( $( compgen -W '$( command ls /etc/munin/plugins )' \
|
||||||
-- "$cur" ) )
|
-- "$cur" ) )
|
||||||
@ -89,9 +88,7 @@ _munin_node_configure()
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--help --version --debug --config \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--servicedir --libdir --families --suggest --shell \
|
|
||||||
--remove-also --snmp --snmpversion --snmpcommunity' -- "$cur" ) )
|
|
||||||
fi
|
fi
|
||||||
} &&
|
} &&
|
||||||
complete -F _munin_node_configure munin-node-configure
|
complete -F _munin_node_configure munin-node-configure
|
||||||
|
@ -45,14 +45,7 @@ _mysqladmin()
|
|||||||
|
|
||||||
$split && return 0
|
$split && return 0
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W '--count --debug-check --debug-info --force \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--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+=( \
|
COMPREPLY+=( \
|
||||||
$( compgen -W 'create debug drop extended-status flush-hosts \
|
$( compgen -W 'create debug drop extended-status flush-hosts \
|
||||||
|
@ -50,9 +50,7 @@ _createdb()
|
|||||||
$split && return 0
|
$split && return 0
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--tablespace --template --encoding --host \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--port --username --password --echo --quiet --help --version' \
|
|
||||||
-- "$cur" ) )
|
|
||||||
else
|
else
|
||||||
_pg_databases
|
_pg_databases
|
||||||
fi
|
fi
|
||||||
@ -87,8 +85,7 @@ _dropdb()
|
|||||||
$split && return 0
|
$split && return 0
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '--host --port --username --password \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--interactive --echo --quiet --help --version' -- "$cur" ) )
|
|
||||||
else
|
else
|
||||||
_pg_databases
|
_pg_databases
|
||||||
fi
|
fi
|
||||||
@ -137,12 +134,7 @@ _psql()
|
|||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
# return list of available options
|
# return list of available options
|
||||||
COMPREPLY=( $( compgen -W '--echo-all --no-align --command --dbname \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--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" ) )
|
|
||||||
else
|
else
|
||||||
# return list of available databases
|
# return list of available databases
|
||||||
_pg_databases
|
_pg_databases
|
||||||
|
@ -23,9 +23,7 @@ _wvdial()
|
|||||||
|
|
||||||
case $cur in
|
case $cur in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W '--config --chat \
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
|
||||||
--remotename --help --version --no-syslog' \
|
|
||||||
-- "$cur" ) )
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# start with global and personal config files
|
# start with global and personal config files
|
||||||
|
Loading…
x
Reference in New Issue
Block a user