From 4f35919e6983ac7ef518f73f78a078f24793d695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Fri, 29 Apr 2011 12:26:46 +0300 Subject: Convert more completions to use _parse_help() instead of hardcoded option lists. --- completions/cpan2dist | 8 +------- completions/cryptsetup | 5 +---- completions/dict | 9 +-------- completions/dpkg | 26 +------------------------- completions/hping2 | 12 +----------- completions/mc | 5 +---- completions/mcrypt | 10 +--------- completions/munin-node | 7 ++----- completions/mysqladmin | 9 +-------- completions/postgresql | 14 +++----------- completions/wvdial | 4 +--- 11 files changed, 14 insertions(+), 95 deletions(-) diff --git a/completions/cpan2dist b/completions/cpan2dist index 6b4b6db4..9845a0a5 100644 --- a/completions/cpan2dist +++ b/completions/cpan2dist @@ -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 diff --git a/completions/cryptsetup b/completions/cryptsetup index f1dd1f3b..be6ea492 100644 --- a/completions/cryptsetup +++ b/completions/cryptsetup @@ -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 \ diff --git a/completions/dict b/completions/dict index bbce1ec2..2bab183b 100644 --- a/completions/dict +++ b/completions/dict @@ -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 diff --git a/completions/dpkg b/completions/dpkg index 68daa54b..dfac2e22 100644 --- a/completions/dpkg +++ b/completions/dpkg @@ -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 diff --git a/completions/hping2 b/completions/hping2 index 9f20fa2e..f30aa675 100644 --- a/completions/hping2 +++ b/completions/hping2 @@ -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 diff --git a/completions/mc b/completions/mc index 3426742a..8e9c9374 100644 --- a/completions/mc +++ b/completions/mc @@ -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 diff --git a/completions/mcrypt b/completions/mcrypt index fc086ca3..d205dba4 100644 --- a/completions/mcrypt +++ b/completions/mcrypt @@ -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 diff --git a/completions/munin-node b/completions/munin-node index 9c50c4c9..c7af5bd3 100644 --- a/completions/munin-node +++ b/completions/munin-node @@ -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 diff --git a/completions/mysqladmin b/completions/mysqladmin index cebe9f0c..cedc59da 100644 --- a/completions/mysqladmin +++ b/completions/mysqladmin @@ -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 \ diff --git a/completions/postgresql b/completions/postgresql index bbb3ce03..9c53dbdd 100644 --- a/completions/postgresql +++ b/completions/postgresql @@ -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 diff --git a/completions/wvdial b/completions/wvdial index 5b4f2b03..555d7070 100644 --- a/completions/wvdial +++ b/completions/wvdial @@ -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 -- cgit v1.2.1