diff options
author | David Paleino <dapal@debian.org> | 2010-02-08 17:25:08 +0100 |
---|---|---|
committer | David Paleino <dapal@debian.org> | 2010-02-08 17:25:08 +0100 |
commit | f8bafe285e7d20fdd82f77289059dd18f78312c2 (patch) | |
tree | 72da1d46320dbd37c733b070180fb3ecac4c4742 | |
parent | 2cd91420d2e9a4ce571cbe4e4a90e512653be151 (diff) | |
download | bash-completion-f8bafe285e7d20fdd82f77289059dd18f78312c2.tar.gz |
Use _get_comp_words_by_ref to set cur, prev, [..] instead of manually using COMP_WORDS
156 files changed, 370 insertions, 581 deletions
diff --git a/bash_completion b/bash_completion index 4dc09ea1..9418aacd 100644 --- a/bash_completion +++ b/bash_completion @@ -1030,8 +1030,7 @@ _service() local cur prev sysvdir COMPREPLY=() - prev=${COMP_WORDS[COMP_CWORD-1]} - cur=`_get_cword` + _get_comp_words_by_ref cur prev # don't complete for things like killall, ssh and mysql if it's # the standalone command, rather than the init script @@ -1064,8 +1063,7 @@ _chown() local cur prev split=false # Get cur and prev words; but don't treat user:group as separate words. - cur=`_get_cword :` - prev=`_get_pword :` + _get_comp_words_by_ref -n : cur prev _split_longopt && split=true @@ -1110,9 +1108,8 @@ _chgrp() local cur prev split=false COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur prev cur=${cur//\\\\/} - prev=${COMP_WORDS[COMP_CWORD-1]} _split_longopt && split=true @@ -1153,7 +1150,7 @@ _rmmod() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _installed_modules "$cur" return 0 @@ -1170,8 +1167,7 @@ _insmod() local cur prev modpath COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev # behave like lsmod for modprobe -r if [[ ${1##*/} == modprobe && "${COMP_WORDS[1]}" == -r ]]; then @@ -1206,7 +1202,7 @@ _renice() local command cur curopt i COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur command=$1 i=0 @@ -1237,7 +1233,7 @@ _kill() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then # return list of available signals @@ -1257,7 +1253,7 @@ _killall() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ $COMP_CWORD -eq 1 && "$cur" == -* ]]; then _signals @@ -1278,7 +1274,7 @@ _pgrep() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _pnames @@ -1297,7 +1293,7 @@ _ifupdown() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [ $COMP_CWORD -eq 1 ]; then _configured_interfaces @@ -1317,8 +1313,7 @@ _ipsec() local cur COMPREPLY=() - cur=`_get_cword` - + _get_comp_words_by_ref cur if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual \ @@ -1359,7 +1354,7 @@ _user_at_host() { local cur COMPREPLY=() - cur=`_get_cword :` + _get_comp_words_by_ref -n : cur if [[ $cur == *@* ]]; then _known_hosts_real "$cur" @@ -1565,7 +1560,8 @@ complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 ping \ # _cd() { - local IFS=$'\t\n' cur=`_get_cword` i j k + local IFS=$'\t\n' i j k + _get_comp_words_by_ref cur # try to allow variable completion if [[ "$cur" == ?(\\)\$* ]]; then @@ -1668,7 +1664,7 @@ _command_offset() COMP_CWORD=$(( $COMP_CWORD - $word_offset )) COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ $COMP_CWORD -eq 0 ]]; then COMPREPLY=( $( compgen -c -- "$cur" ) ) @@ -1722,8 +1718,7 @@ _longopt() { local cur prev - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev if _split_longopt; then case "$prev" in @@ -1771,7 +1766,7 @@ _look() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [ $COMP_CWORD = 1 ]; then COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) ) @@ -1787,7 +1782,7 @@ _id() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\ @@ -1804,7 +1799,7 @@ _filedir_xspec() IFS=$'\t\n' COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _expand || return 0 diff --git a/contrib/_modules b/contrib/_modules index 73a7190f..f1ad88d8 100644 --- a/contrib/_modules +++ b/contrib/_modules @@ -49,8 +49,7 @@ _module () local cur prev options COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev if [ $COMP_CWORD -eq 1 ] ; then # First parameter on line -- we expect it to be a mode selection diff --git a/contrib/_subversion b/contrib/_subversion index 643ba0d6..06adf830 100644 --- a/contrib/_subversion +++ b/contrib/_subversion @@ -10,7 +10,7 @@ _svn() local cur prev commands options command COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur prev commands='add blame praise annotate ann cat checkout co cleanup commit \ ci copy cp delete del remove rm diff di export help ? h import \ @@ -27,7 +27,6 @@ _svn() fi else - prev=${COMP_WORDS[COMP_CWORD-1]} case $prev in --config-dir) _filedir -d @@ -280,7 +279,7 @@ _svnadmin() local cur prev commands options mode COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur prev commands='create deltify dump help ? hotcopy list-dblogs \ list-unused-dblogs load lslocks lstxns recover rmlocks \ @@ -293,7 +292,6 @@ _svnadmin() COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) fi else - prev=${COMP_WORDS[COMP_CWORD-1]} case $prev in --config-dir) _filedir -d @@ -359,7 +357,7 @@ _svnlook() local cur prev commands options mode COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur commands='author cat changed date diff dirs-changed help ? h history \ info lock log propget pget pg proplist plist pl tree uuid \ diff --git a/contrib/_yum b/contrib/_yum index 7ec3b1aa..19b79cee 100644 --- a/contrib/_yum +++ b/contrib/_yum @@ -39,8 +39,7 @@ _yum() local cur prev special i split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then diff --git a/contrib/_yum-utils b/contrib/_yum-utils index 1914ba0a..49a57f76 100644 --- a/contrib/_yum-utils +++ b/contrib/_yum-utils @@ -9,8 +9,7 @@ _repomanage() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev [[ "$prev" == -@(h|-help|k|-keep) ]] && return 0 diff --git a/contrib/abook b/contrib/abook index b01c932b..2a3bc4f6 100644 --- a/contrib/abook +++ b/contrib/abook @@ -6,8 +6,7 @@ _abook() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev # abook only takes options, tabbing after command name adds a single # dash (bash4) diff --git a/contrib/ant b/contrib/ant index 9ba08525..e0d835d6 100644 --- a/contrib/ant +++ b/contrib/ant @@ -7,8 +7,7 @@ _ant() local cur prev buildfile i COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -buildfile|-file|-f) diff --git a/contrib/apache2ctl b/contrib/apache2ctl index d10ac666..5214ba3e 100644 --- a/contrib/apache2ctl +++ b/contrib/apache2ctl @@ -5,7 +5,7 @@ _apache2ctl() { local APWORDS COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur APWORDS=$(apache2ctl 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | \ tr "|" " ") diff --git a/contrib/apt b/contrib/apt index 53a7dcc9..533d0c5d 100644 --- a/contrib/apt +++ b/contrib/apt @@ -6,8 +6,7 @@ _apt_get() local cur prev special i COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep) ]]; then @@ -76,9 +75,7 @@ _apt_cache() local cur prev special i COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} - + _get_comp_words_by_ref cur prev if [ "$cur" != show ]; then for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do diff --git a/contrib/apt-build b/contrib/apt-build index 9d9508f3..9597ae8d 100644 --- a/contrib/apt-build +++ b/contrib/apt-build @@ -6,8 +6,7 @@ _apt_build() local cur prev special i COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do if [[ ${COMP_WORDS[i]} == @(install|remove|source|info|clean) ]]; then diff --git a/contrib/aptitude b/contrib/aptitude index e4c8b688..c00ad40e 100644 --- a/contrib/aptitude +++ b/contrib/aptitude @@ -19,9 +19,7 @@ _aptitude() local cur dashoptions prev special i COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} - + _get_comp_words_by_ref cur prev dashoptions='-S -u -i -h --help --version -s --simulate -d \ --download-only -P --prompt -y --assume-yes -F \ diff --git a/contrib/aspell b/contrib/aspell index 9c56c992..e063f497 100644 --- a/contrib/aspell +++ b/contrib/aspell @@ -19,8 +19,7 @@ _aspell() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/autorpm b/contrib/autorpm index e111af02..6a5f7620 100644 --- a/contrib/autorpm +++ b/contrib/autorpm @@ -6,7 +6,7 @@ _autorpm() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur COMPREPLY=( $( compgen -W '--notty --debug --help --version auto add \ fullinfo info help install list remove set' -- "$cur" ) ) diff --git a/contrib/bash-builtins b/contrib/bash-builtins index 61c9d8d4..aac75ae0 100644 --- a/contrib/bash-builtins +++ b/contrib/bash-builtins @@ -5,7 +5,7 @@ _alias() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur case $COMP_LINE in *[^=]) @@ -26,7 +26,7 @@ _export() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur case $COMP_LINE in *=\$*) @@ -52,8 +52,7 @@ _function() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev if [[ $1 == @(declare|typeset) ]]; then if [ "$prev" = -f ]; then @@ -76,8 +75,7 @@ _complete() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -o) diff --git a/contrib/bind-utils b/contrib/bind-utils index 6c005392..040d1975 100644 --- a/contrib/bind-utils +++ b/contrib/bind-utils @@ -6,7 +6,7 @@ _nslookup() local cur COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]#-} + _get_comp_words_by_ref cur COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= srchlist= \ defname search port= querytype= type= recurse retry root timeout vc \ diff --git a/contrib/bitkeeper b/contrib/bitkeeper index 7d48869c..4c312a14 100644 --- a/contrib/bitkeeper +++ b/contrib/bitkeeper @@ -5,7 +5,7 @@ _bk() { local BKCMDS COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur BKCMDS="$( bk help topics | awk '/^ bk/ { print $4 }' | \ xargs printf '%s ' )" diff --git a/contrib/bittorrent b/contrib/bittorrent index 4c0fe7fb..761d0836 100644 --- a/contrib/bittorrent +++ b/contrib/bittorrent @@ -7,8 +7,7 @@ _btdownload() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --responsefile|--saveas) diff --git a/contrib/bluez b/contrib/bluez index c0b70bc6..4b5f8f92 100644 --- a/contrib/bluez +++ b/contrib/bluez @@ -46,8 +46,7 @@ _hcitool() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -129,8 +128,7 @@ _sdptool() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -191,8 +189,7 @@ _l2ping() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -i) @@ -215,8 +212,7 @@ _rfcomm() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -f|--config) @@ -261,8 +257,7 @@ _ciptool() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -i) @@ -298,8 +293,7 @@ _dfutool() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -d|--device) @@ -330,7 +324,7 @@ _hciconfig() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _get_command if [ -z $command ]; then @@ -376,7 +370,7 @@ _hciattach() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-n -p -t -b -s -l' -- "$cur" ) ) @@ -414,7 +408,7 @@ _hid2hci() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--help --quiet -0 --tohci -1 \ @@ -428,7 +422,7 @@ _avctrl() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--help --quiet' -- "$cur" ) ) diff --git a/contrib/brctl b/contrib/brctl index 14401eee..1be86af1 100644 --- a/contrib/brctl +++ b/contrib/brctl @@ -6,7 +6,7 @@ _brctl() local cur command COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur command=${COMP_WORDS[1]} case $COMP_CWORD in diff --git a/contrib/bzip2 b/contrib/bzip2 index 9001dd58..f4902e29 100644 --- a/contrib/bzip2 +++ b/contrib/bzip2 @@ -6,8 +6,7 @@ _bzip2() local cur prev xspec helpopts COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev helpopts=`_parse_help ${COMP_WORDS[0]}` case $prev in diff --git a/contrib/cardctl b/contrib/cardctl index dfd7403b..1af7491b 100644 --- a/contrib/cardctl +++ b/contrib/cardctl @@ -6,7 +6,7 @@ _cardctl() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $( compgen -W 'status config ident suspend \ diff --git a/contrib/cfengine b/contrib/cfengine index 2f758024..8a850054 100644 --- a/contrib/cfengine +++ b/contrib/cfengine @@ -20,8 +20,7 @@ _cfagent() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -f|--file) @@ -38,10 +37,10 @@ complete -F _cfagent cfagent _cfrun() { - local i section cfinputs + local i section cfinputs cur prev COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur prev section=1 for (( i=1; i < COMP_CWORD; i++ )); do @@ -52,7 +51,6 @@ _cfrun() case $section in 1) - prev=${COMP_WORDS[COMP_CWORD-1]} case $prev in -f) _filedir diff --git a/contrib/chkconfig b/contrib/chkconfig index 7f65d069..2d02e56e 100644 --- a/contrib/chkconfig +++ b/contrib/chkconfig @@ -6,8 +6,7 @@ _chkconfig() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/chsh b/contrib/chsh index fd947b8f..1af3630f 100644 --- a/contrib/chsh +++ b/contrib/chsh @@ -5,8 +5,7 @@ _chsh() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --list-shells|--help|-v|--version) diff --git a/contrib/cksfv b/contrib/cksfv index 34bf0f5d..1f83824b 100644 --- a/contrib/cksfv +++ b/contrib/cksfv @@ -3,15 +3,17 @@ have cksfv && _cksfv() { + local cur prev + COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur prev if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $( compgen -W '-C -f -i -q -v' -- "$cur" ) ) return 0 fi - case ${COMP_WORDS[$COMP_CWORD-1]} in + case "$prev" in -C) _filedir -d return 0 diff --git a/contrib/clisp b/contrib/clisp index 18b783e4..074f692c 100644 --- a/contrib/clisp +++ b/contrib/clisp @@ -7,7 +7,7 @@ _clisp() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur # completing an option (may or may not be separated by a space) if [[ "$cur" == -* ]]; then diff --git a/contrib/configure b/contrib/configure index 419b744e..d69f85b1 100644 --- a/contrib/configure +++ b/contrib/configure @@ -5,8 +5,7 @@ _configure() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/cowsay b/contrib/cowsay index f3ed3bd9..c6d797aa 100644 --- a/contrib/cowsay +++ b/contrib/cowsay @@ -6,8 +6,7 @@ _cowsay() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -f) diff --git a/contrib/cpan2dist b/contrib/cpan2dist index f6974d40..13f568af 100644 --- a/contrib/cpan2dist +++ b/contrib/cpan2dist @@ -6,8 +6,7 @@ _cpan2dist() local cur prev packagelist cpandirs COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --format) diff --git a/contrib/cpio b/contrib/cpio index dddfc190..e77b4153 100644 --- a/contrib/cpio +++ b/contrib/cpio @@ -11,8 +11,7 @@ _cpio() local cur prev split=false COMPREPLY=() - cur=`_get_cword :` - prev=`_get_pword :` + _get_comp_words_by_ref -n : cur prev _split_longopt && split=true diff --git a/contrib/cups b/contrib/cups index 9550808e..80c9af54 100644 --- a/contrib/cups +++ b/contrib/cups @@ -6,7 +6,7 @@ _cancel() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur COMPREPLY=( $( compgen -W "$( lpstat | cut -d' ' -f1 )" -- "$cur" ) ) } && diff --git a/contrib/cvs b/contrib/cvs index 5c915d51..04837cd1 100644 --- a/contrib/cvs +++ b/contrib/cvs @@ -60,8 +60,7 @@ _cvs() local -a flags miss files entries changed newremoved COMPREPLY=() - cur=`_get_cword :` - prev=`_get_pword :` + _get_comp_words_by_ref -n : cur prev count=0 for i in "${COMP_WORDS[@]}"; do diff --git a/contrib/cvsps b/contrib/cvsps index a9566f64..257437bc 100644 --- a/contrib/cvsps +++ b/contrib/cvsps @@ -4,7 +4,8 @@ have cvsps && _cvsps() { COMPREPLY=() - local cur=`_get_cword :` prev=`_get_pword :` + local cur prev + _get_comp_words_by_ref -n : cur prev case $prev in -h|-z|-f|-d|-l|--diff-opts|--debuglvl) @@ -6,7 +6,7 @@ _dd() local cur COMPREPLY=() - cur=`_get_cword =` + _get_comp_words_by_ref -n = cur case $cur in if=*|of=*) diff --git a/contrib/dhclient b/contrib/dhclient index 5ce15883..3d7e1e1a 100644 --- a/contrib/dhclient +++ b/contrib/dhclient @@ -5,8 +5,7 @@ have dhclient && _dhclient() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -cf|-lf|-pf|-sf) diff --git a/contrib/dict b/contrib/dict index 0b6a1ba5..4cfdf98f 100644 --- a/contrib/dict +++ b/contrib/dict @@ -12,8 +12,7 @@ _dict() local cur prev host port db dictfile COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev dictfile=/usr/share/dict/words for (( i=1; i < COMP_CWORD; i++ )); do diff --git a/contrib/dpkg b/contrib/dpkg index 69493b34..af93e531 100644 --- a/contrib/dpkg +++ b/contrib/dpkg @@ -23,8 +23,7 @@ _dpkg() local cur prev i COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev i=$COMP_CWORD _expand || return 0 @@ -104,9 +103,7 @@ _dpkg_reconfigure() local cur prev opt COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} - + _get_comp_words_by_ref cur prev case $prev in -f|--frontend) @@ -146,8 +143,7 @@ _dpkg_source() if [ "$1" != "dpkg-source" ]; then return 1 fi - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev action="options" for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do if [[ ${COMP_WORDS[$i]} == "-x" ]]; then diff --git a/contrib/dselect b/contrib/dselect index ddd22927..8bea891a 100644 --- a/contrib/dselect +++ b/contrib/dselect @@ -6,8 +6,7 @@ _dselect() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --admindir) diff --git a/contrib/dsniff b/contrib/dsniff index 055d2013..ab93343c 100644 --- a/contrib/dsniff +++ b/contrib/dsniff @@ -6,8 +6,7 @@ _arpspoof() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -i) @@ -35,8 +34,7 @@ _dnsspoof() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -i) @@ -62,8 +60,7 @@ _dsniff() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -r|-w|-f) @@ -89,8 +86,7 @@ _snarf() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -i) @@ -112,8 +108,7 @@ _macof() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -i) @@ -136,7 +131,7 @@ _sshmitm() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-d -I -p' -- "$cur" ) ) @@ -153,8 +148,7 @@ _sshow() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -i) @@ -176,8 +170,7 @@ _tcpkill() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -i) @@ -199,8 +192,7 @@ _tcpnice() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -i) @@ -222,8 +214,7 @@ _urlsnarf() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -i) @@ -245,7 +236,7 @@ _webmitm() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-d' -- "$cur" ) ) diff --git a/contrib/findutils b/contrib/findutils index 290c3954..551839ea 100644 --- a/contrib/findutils +++ b/contrib/findutils @@ -8,8 +8,7 @@ _find() local cur prev i exprfound onlyonce COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -maxdepth|-mindepth) diff --git a/contrib/freeciv b/contrib/freeciv index 6f5e167c..602ad76a 100644 --- a/contrib/freeciv +++ b/contrib/freeciv @@ -6,8 +6,7 @@ _civserver() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -f|-g|-l|-r|--file|--log|--gamelog|--read) @@ -31,8 +30,7 @@ _civclient() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -l|-S|-t|--log|--Sound|--tiles) diff --git a/contrib/fuse b/contrib/fuse index e09b8757..b4d80a28 100644 --- a/contrib/fuse +++ b/contrib/fuse @@ -4,7 +4,8 @@ have fusermount && _fusermount() { COMPREPLY=() - local cur=`_get_cword` prev=`_get_pword` + local cur prev + _get_comp_words_by_ref cur prev case $prev in -h|-V|-o) diff --git a/contrib/gcc b/contrib/gcc index b3cdeb7e..3f5a5619 100644 --- a/contrib/gcc +++ b/contrib/gcc @@ -14,7 +14,7 @@ _gcc() local cur cc backend COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _expand || return 0 diff --git a/contrib/gcl b/contrib/gcl index e3df88cf..e0931536 100644 --- a/contrib/gcl +++ b/contrib/gcl @@ -7,7 +7,7 @@ _gcl() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur # completing an option (may or may not be separated by a space) if [[ "$cur" == -* ]]; then diff --git a/contrib/gdb b/contrib/gdb index e33ec029..dc769613 100644 --- a/contrib/gdb +++ b/contrib/gdb @@ -6,8 +6,7 @@ _gdb() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev if [ $COMP_CWORD -eq 1 ]; then local IFS diff --git a/contrib/genisoimage b/contrib/genisoimage index 4aafe250..7f379041 100644 --- a/contrib/genisoimage +++ b/contrib/genisoimage @@ -6,8 +6,7 @@ _mkisofs() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -o|-abstract|-biblio|-check-session|-copyright|-log-file| \ diff --git a/contrib/getent b/contrib/getent index 008f3abc..54e62ab8 100644 --- a/contrib/getent +++ b/contrib/getent @@ -6,8 +6,7 @@ _getent() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in passwd) diff --git a/contrib/gkrellm b/contrib/gkrellm index 08b5b6d8..1e3925f1 100644 --- a/contrib/gkrellm +++ b/contrib/gkrellm @@ -6,8 +6,7 @@ _gkrellm() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -t|--theme) diff --git a/contrib/gnatmake b/contrib/gnatmake index 42e9bcef..11b04908 100644 --- a/contrib/gnatmake +++ b/contrib/gnatmake @@ -6,7 +6,7 @@ _gnatmake() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then # relevant (and less relevant ;-) )options completion diff --git a/contrib/gpg b/contrib/gpg index 3d9ad4d5..878a800b 100644 --- a/contrib/gpg +++ b/contrib/gpg @@ -6,8 +6,7 @@ _gpg() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -s|--sign|--clearsign|--decrypt-files|--load-extension) diff --git a/contrib/gpg2 b/contrib/gpg2 index 2017bdd0..b99783f9 100644 --- a/contrib/gpg2 +++ b/contrib/gpg2 @@ -6,8 +6,7 @@ _gpg2 () local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --homedir) diff --git a/contrib/gzip b/contrib/gzip index 08243857..50f59fba 100644 --- a/contrib/gzip +++ b/contrib/gzip @@ -6,8 +6,7 @@ _gzip() local cur prev xspec helpopts COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev helpopts=`_parse_help ${COMP_WORDS[0]}` case $prev in diff --git a/contrib/heimdal b/contrib/heimdal index 9e3d181e..c1efb110 100644 --- a/contrib/heimdal +++ b/contrib/heimdal @@ -28,8 +28,7 @@ _ktutil() local cur prev command options split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/iconv b/contrib/iconv index 19a4c59e..583f2a6b 100644 --- a/contrib/iconv +++ b/contrib/iconv @@ -6,8 +6,7 @@ _iconv() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -f|-t|--from-code|--to-code) diff --git a/contrib/imagemagick b/contrib/imagemagick index caa758e0..5366e619 100644 --- a/contrib/imagemagick +++ b/contrib/imagemagick @@ -3,8 +3,8 @@ have convert && { _ImageMagick() { - local prev - prev=${COMP_WORDS[COMP_CWORD-1]} + local cur prev + _get_comp_words_by_ref cur prev case $prev in -channel) @@ -135,7 +135,7 @@ _convert() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _ImageMagick @@ -196,7 +196,7 @@ _mogrify() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _ImageMagick @@ -252,7 +252,7 @@ _display() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _ImageMagick @@ -292,7 +292,7 @@ _animate() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _ImageMagick @@ -326,7 +326,7 @@ _identify() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _ImageMagick @@ -351,7 +351,7 @@ _montage() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _ImageMagick @@ -389,7 +389,7 @@ _composite() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _ImageMagick @@ -424,7 +424,7 @@ _compare() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _ImageMagick @@ -451,7 +451,7 @@ _conjure() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _ImageMagick @@ -471,7 +471,7 @@ _import() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _ImageMagick @@ -502,7 +502,7 @@ _stream() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _ImageMagick diff --git a/contrib/info b/contrib/info index 691edf64..55791d31 100644 --- a/contrib/info +++ b/contrib/info @@ -6,7 +6,7 @@ _info() local cur i infopath COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur _expand || return 0 diff --git a/contrib/ipmitool b/contrib/ipmitool index 112b0965..fc4ec71c 100644 --- a/contrib/ipmitool +++ b/contrib/ipmitool @@ -6,8 +6,7 @@ _ipmitool() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -I) diff --git a/contrib/iptables b/contrib/iptables index 405b7eec..bd0e4622 100644 --- a/contrib/iptables +++ b/contrib/iptables @@ -6,8 +6,7 @@ _iptables() local cur prev table chain COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p' if [[ $COMP_LINE == *-t\ *filter* ]]; then diff --git a/contrib/ipv6calc b/contrib/ipv6calc index dca4c144..75f55e74 100644 --- a/contrib/ipv6calc +++ b/contrib/ipv6calc @@ -4,8 +4,9 @@ _ipv6calc() local cur prev split=false COMPREPLY=() - cur=`_get_cword =` - prev=`_get_pword` + _get_comp_words_by_ref -n = cur prev + #cur=`_get_cword =` + #prev=`_get_pword` _split_longopt && split=true diff --git a/contrib/isql b/contrib/isql index fef0c0aa..f0ddbd75 100644 --- a/contrib/isql +++ b/contrib/isql @@ -4,7 +4,7 @@ have isql && _isql() { local cur - cur=`_get_cword` + _get_comp_words_by_ref cur [ -f "$ODBCINI" ] \ && COMPREPLY=( $( command grep \\["$cur" "$ODBCINI" | tr -d \\[\\] ) ) diff --git a/contrib/jar b/contrib/jar index 11d3ffe9..75dcaf3e 100644 --- a/contrib/jar +++ b/contrib/jar @@ -6,7 +6,7 @@ _jar() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [ $COMP_CWORD = 1 ]; then COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) ) diff --git a/contrib/java b/contrib/java index b9418ed8..76d2cd4e 100644 --- a/contrib/java +++ b/contrib/java @@ -121,8 +121,7 @@ _java() local cur prev i COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev for ((i=1; i < $COMP_CWORD; i++)); do case ${COMP_WORDS[$i]} in @@ -174,8 +173,7 @@ _javadoc() COMPREPLY=() local cur prev classpath - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -overview|-helpfile|-stylesheetfile) @@ -222,8 +220,7 @@ _javac() COMPREPLY=() local cur prev - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -d) @@ -253,7 +250,8 @@ have pack200 && _pack200() { COMPREPLY=() - local cur=`_get_cword` prev=`_get_pword` + local cur prev + _get_comp_words_by_ref cur prev case $prev in -S|--segment-limit|-P|--pass-file|-C|--class-attribute|\ @@ -320,7 +318,8 @@ have unpack200 && _unpack200() { COMPREPLY=() - local cur=`_get_cword` prev=`_get_pword` + local cur prev + _get_comp_words_by_ref cur prev case $prev in '-?'|-h|--help|-V|--version|-J) @@ -365,7 +364,8 @@ have jarsigner && _jarsigner() { COMPREPLY=() - local cur=`_get_cword` prev=`_get_pword` + local cur prev + _get_comp_words_by_ref cur prev case $prev in -keystore) diff --git a/contrib/k3b b/contrib/k3b index 44a4ed09..a2b0af6b 100644 --- a/contrib/k3b +++ b/contrib/k3b @@ -3,7 +3,8 @@ have k3b && _k3b() { - local cur=`_get_cword` prev=${COMP_WORDS[COMP_CWORD-1]} + local cur prev + _get_comp_words_by_ref cur prev COMPREPLY=() case $prev in diff --git a/contrib/kldload b/contrib/kldload index ff5ced1d..a230dbb5 100644 --- a/contrib/kldload +++ b/contrib/kldload @@ -9,7 +9,7 @@ _kldload() moddir=/modules/ [ -d $moddir ] || moddir=/boot/kernel/ - cur=`_get_cword` + _get_comp_words_by_ref cur COMPREPLY=( $( compgen -f "$moddir$cur" ) ) COMPREPLY=( ${COMPREPLY[@]#$moddir} ) @@ -22,7 +22,7 @@ complete -F _kldload -o filenames kldload _kldunload() { local cur - cur=`_get_cword` + _get_comp_words_by_ref cur COMPREPLY=( $( kldstat | \ sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) ) } diff --git a/contrib/larch b/contrib/larch index 6dcaf545..e58374f7 100644 --- a/contrib/larch +++ b/contrib/larch @@ -6,8 +6,7 @@ _larch() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then COMPREPLY=( $( compgen -W ' \ diff --git a/contrib/ldapvi b/contrib/ldapvi index 7a64b0fe..31e26d1c 100644 --- a/contrib/ldapvi +++ b/contrib/ldapvi @@ -6,8 +6,7 @@ _ldapvi() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -h|--host) diff --git a/contrib/lftp b/contrib/lftp index ba1f4938..15d0a977 100644 --- a/contrib/lftp +++ b/contrib/lftp @@ -6,8 +6,7 @@ _lftp() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -f) @@ -34,7 +33,8 @@ have lftpget && _lftpget() { COMPREPLY=() - local cur=`_get_cword` + local cur + _get_comp_words_by_ref cur if [[ "$cur" == -* ]] ; then COMPREPLY=( $( compgen -W '-c -d -v' -- "$cur" ) ) diff --git a/contrib/lilo b/contrib/lilo index c5ff155a..ab0d9dc3 100644 --- a/contrib/lilo +++ b/contrib/lilo @@ -12,8 +12,7 @@ _lilo() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -C|-i|-m|-s|-S) diff --git a/contrib/links b/contrib/links index 62b8ead1..4b5c683a 100644 --- a/contrib/links +++ b/contrib/links @@ -6,7 +6,7 @@ _links() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur case $cur in --*) diff --git a/contrib/lisp b/contrib/lisp index a88db35a..ee43a019 100644 --- a/contrib/lisp +++ b/contrib/lisp @@ -7,7 +7,7 @@ _lisp() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur # completing an option (may or may not be separated by a space) if [[ "$cur" == -* ]]; then diff --git a/contrib/lvm b/contrib/lvm index 63284cf3..f4d3b77d 100644 --- a/contrib/lvm +++ b/contrib/lvm @@ -49,7 +49,7 @@ _lvmdiskscan() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--debug --help \ @@ -63,7 +63,7 @@ _pvscan() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--debug --exported --novolumegroup \ @@ -78,8 +78,7 @@ _pvs() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -o|-O|--options|--sort) @@ -111,8 +110,7 @@ _pvdisplay() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --units) @@ -135,8 +133,7 @@ _pvchange() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|-x|--autobackup|--allocatable) @@ -161,8 +158,7 @@ _pvcreate() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --restorefile) @@ -200,8 +196,7 @@ _pvmove() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|--autobackup) @@ -228,7 +223,7 @@ _pvremove() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--debug --force \ @@ -244,7 +239,7 @@ _vgscan() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--debug --help \ @@ -259,8 +254,7 @@ _vgs() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -o|-O|--options|--sort) @@ -294,8 +288,7 @@ _vgdisplay() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --units) @@ -319,8 +312,7 @@ _vgchange() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -a|-A|-x|--available|--autobackup|--resizeable) @@ -346,8 +338,7 @@ _vgcreate() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|--autobackup) @@ -385,7 +376,7 @@ _vgremove() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--debug --help --test \ @@ -401,8 +392,7 @@ _vgrename() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|--autobackup) @@ -425,8 +415,7 @@ _vgreduce() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|--autobackup) @@ -456,8 +445,7 @@ _vgextend() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|--autobackup) @@ -489,7 +477,7 @@ _vgport() local cur prev COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--all --debug \ @@ -502,10 +490,10 @@ complete -F _vgport vgimport vgexport _vgck() { - local cur prev + local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--debug \ @@ -521,8 +509,7 @@ _vgconvert() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -M|--metadatatype) @@ -554,8 +541,7 @@ _vgcfgbackup() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -f|--file) @@ -579,8 +565,7 @@ _vgcfgrestore() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -f|--file) @@ -612,8 +597,7 @@ _vgmerge() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|--autobackup) @@ -636,8 +620,7 @@ _vgsplit() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|--autobackup) @@ -670,7 +653,7 @@ _vgmknodes() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--debug --help --verbose \ @@ -686,7 +669,7 @@ _lvscan() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--blockdevice --debug \ @@ -701,8 +684,7 @@ _lvs() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -o|-O|--options|--sort) @@ -733,8 +715,7 @@ _lvdisplay() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --units) @@ -757,8 +738,7 @@ _lvchange() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -a|-A|-C|-M|--available|--autobackup|--continguous|--persistent) @@ -789,8 +769,7 @@ _lvcreate() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|-C|-M|-Z|--autobackup|--continguous|--persistent|--zero) @@ -834,8 +813,7 @@ _lvremove() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|--autobackup) @@ -858,8 +836,7 @@ _lvrename() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|--autobackup) @@ -882,8 +859,7 @@ _lvreduce() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|--autobackup) @@ -911,8 +887,7 @@ _lvresize() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|--autobackup) @@ -946,8 +921,7 @@ _lvextend() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -A|--autobackup) @@ -981,7 +955,7 @@ _lvm() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \ diff --git a/contrib/lzma b/contrib/lzma index 8f14e489..1846705c 100644 --- a/contrib/lzma +++ b/contrib/lzma @@ -6,8 +6,7 @@ _lzma() local cur prev xspec COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 \ diff --git a/contrib/lzop b/contrib/lzop index 21b085f7..19852b24 100644 --- a/contrib/lzop +++ b/contrib/lzop @@ -6,8 +6,7 @@ _lzop() local cur prev xspec COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 -P \ diff --git a/contrib/mailman b/contrib/mailman index 7af891d9..33227897 100644 --- a/contrib/mailman +++ b/contrib/mailman @@ -11,7 +11,7 @@ _list_lists() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--advertised --virtual-host-overview \ @@ -28,8 +28,7 @@ _add_members() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -63,8 +62,7 @@ _remove_members() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -93,8 +91,7 @@ _find_member() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -121,8 +118,7 @@ _clone_member() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -149,8 +145,7 @@ _sync_members() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -183,7 +178,7 @@ _unshunt() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--help' -- "$cur" ) ) @@ -200,7 +195,7 @@ _list_admins() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--all-vhost --all --help' -- "$cur" ) ) @@ -217,7 +212,7 @@ _list_owners() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--with-listnames --moderators \ @@ -235,8 +230,7 @@ _list_members() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -274,8 +268,7 @@ _change_pw() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -302,7 +295,7 @@ _withlist() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--lock --interactive \ @@ -320,7 +313,7 @@ _newlist() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--language --quiet --help' -- "$cur" ) ) @@ -337,7 +330,7 @@ _rmlist() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--archives --help' -- "$cur" ) ) @@ -354,8 +347,7 @@ _config_list() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -386,8 +378,7 @@ _arch() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -433,7 +424,7 @@ _cleanarch() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--status --dry-run --quiet \ @@ -449,8 +440,7 @@ _inject() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -478,7 +468,7 @@ _dumpdb() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--marshal --pickle --noprint \ @@ -496,7 +486,7 @@ _check_db() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--all --verbose --help' -- "$cur" ) ) @@ -513,7 +503,7 @@ _check_perms() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-f -v -h' -- "$cur" ) ) @@ -528,7 +518,7 @@ _genaliases() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--quiet --help' -- "$cur" ) ) @@ -543,7 +533,7 @@ _mmsitepass() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--listcreator --help' -- "$cur" ) ) @@ -558,8 +548,7 @@ _qrunner() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && return 0 @@ -577,7 +566,7 @@ _mailmanctl() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--no-restart --run-as-user \ diff --git a/contrib/make b/contrib/make index 79f373fe..e792b348 100644 --- a/contrib/make +++ b/contrib/make @@ -6,8 +6,7 @@ _make() local file makef makef_dir="." makef_inc cur prev i split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/man b/contrib/man index ead03eb9..c6cac470 100644 --- a/contrib/man +++ b/contrib/man @@ -11,8 +11,7 @@ _man() mansect="@([0-9lnp]|[0-9][px]|3pm)" COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev if [[ "$prev" == -l ]]; then _filedir $manext @@ -6,8 +6,7 @@ _mc() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/mcrypt b/contrib/mcrypt index 5f9474c7..e777150f 100644 --- a/contrib/mcrypt +++ b/contrib/mcrypt @@ -6,8 +6,7 @@ _mcrypt() local cur prev i decrypt COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -g|--openpgp-z) diff --git a/contrib/mdadm b/contrib/mdadm index 425a6c01..9cbaad7b 100644 --- a/contrib/mdadm +++ b/contrib/mdadm @@ -75,8 +75,7 @@ _mdadm() local cur prev mode options split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/minicom b/contrib/minicom index b2ffcb07..76553317 100644 --- a/contrib/minicom +++ b/contrib/minicom @@ -6,8 +6,7 @@ _minicom() local cur prev confdir COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -a|-c) diff --git a/contrib/mkinitrd b/contrib/mkinitrd index 0ac6f434..48893471 100644 --- a/contrib/mkinitrd +++ b/contrib/mkinitrd @@ -6,8 +6,7 @@ _mkinitrd() local cur prev args split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/mock b/contrib/mock index 60a099f0..f0daac31 100644 --- a/contrib/mock +++ b/contrib/mock @@ -6,8 +6,7 @@ _mock() local cur prev plugins cfgdir split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev plugins='tmpfs root_cache yum_cache bind_mount ccache' cfgdir=/etc/mock diff --git a/contrib/monodevelop b/contrib/monodevelop index 29bf0cad..1aa117b0 100644 --- a/contrib/monodevelop +++ b/contrib/monodevelop @@ -4,7 +4,7 @@ have monodevelop && _monodevelop() { local cur - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-? -help -help2 -ipc-tcp -newwindow -nologo \ @@ -23,8 +23,7 @@ _mdtool() COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do if [[ ${COMP_WORDS[i]} == @(build|generate-makefiles|setup) ]]; then diff --git a/contrib/mount b/contrib/mount index d8ba81bc..884494a5 100644 --- a/contrib/mount +++ b/contrib/mount @@ -12,8 +12,7 @@ _mount() local cur sm host prev COMPREPLY=() - cur=`_get_cword ':'` - prev=`_get_pword ':'` + _get_comp_words_by_ref -n : cur prev [[ "$cur" == \\ ]] && cur="/" if [[ "$cur" == *:* ]]; then @@ -65,7 +64,7 @@ _umount() local cur IFS=$'\n' COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- "$cur" ) ) diff --git a/contrib/mplayer b/contrib/mplayer index 1dd5010b..0fa133eb 100644 --- a/contrib/mplayer +++ b/contrib/mplayer @@ -15,8 +15,7 @@ _mplayer() COMPREPLY=() cmd=${COMP_WORDS[0]} - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile) diff --git a/contrib/msynctool b/contrib/msynctool index 0ab178ec..3f9afb7f 100644 --- a/contrib/msynctool +++ b/contrib/msynctool @@ -6,11 +6,7 @@ _msynctool() local cur prev anteprev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} - if [ $COMP_CWORD -ge 2 ]; then - anteprev=${COMP_WORDS[COMP_CWORD-2]} - fi + _get_comp_words_by_ref cur prev anteprev case $anteprev in --configure) diff --git a/contrib/mtx b/contrib/mtx index 4b20ba70..0454f032 100644 --- a/contrib/mtx +++ b/contrib/mtx @@ -6,8 +6,7 @@ _mtx() local cur prev options tapes drives COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev options="-f nobarcode invert noattach --version inquiry noattach \ inventory status load unload eepos first last next" diff --git a/contrib/munin-node b/contrib/munin-node index 405ece7f..abf2b0f6 100644 --- a/contrib/munin-node +++ b/contrib/munin-node @@ -6,8 +6,7 @@ _munin_run() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=`_get_pword` + _get_comp_words_by_ref cur prev case $prev in --config|--sconffile) @@ -36,8 +35,7 @@ _munindoc() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=`_get_pword` + _get_comp_words_by_ref cur prev COMPREPLY=( $( compgen -W '$( command ls /usr/share/munin/plugins )' \ -- "$cur" ) ) @@ -50,8 +48,7 @@ _munin_update() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=`_get_pword` + _get_comp_words_by_ref cur prev case $prev in --config) @@ -78,8 +75,7 @@ _munin_node_configure() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=`_get_pword` + _get_comp_words_by_ref cur prev case $prev in --config) diff --git a/contrib/mutt b/contrib/mutt index 8d1d86b5..fc12e690 100644 --- a/contrib/mutt +++ b/contrib/mutt @@ -137,8 +137,9 @@ _muttfiledir() _mutt() { local cur prev - cur=`_get_cword =+!` - prev=`_get_pword =+!` + _get_comp_words_by_ref -n =+! cur prev + #cur=`_get_cword =+!` + #prev=`_get_pword =+!` COMPREPLY=() diff --git a/contrib/mysqladmin b/contrib/mysqladmin index 247fa7d1..a7e002d3 100644 --- a/contrib/mysqladmin +++ b/contrib/mysqladmin @@ -6,8 +6,7 @@ _mysqladmin() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/ncftp b/contrib/ncftp index ba003aaf..b831f444 100644 --- a/contrib/ncftp +++ b/contrib/ncftp @@ -6,7 +6,7 @@ _ncftp() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ $COMP_CWORD -eq 1 && -f ~/.ncftp/bookmarks ]]; then COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \ diff --git a/contrib/net-tools b/contrib/net-tools index 15e39782..5b86a64a 100644 --- a/contrib/net-tools +++ b/contrib/net-tools @@ -6,8 +6,7 @@ _mii_tool() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -41,8 +40,7 @@ _mii_diag() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -76,8 +74,7 @@ _route() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev if [ "$prev" = dev ]; then _available_interfaces diff --git a/contrib/ntpdate b/contrib/ntpdate index 233f69f1..bf004b55 100644 --- a/contrib/ntpdate +++ b/contrib/ntpdate @@ -6,8 +6,7 @@ _ntpdate() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -k) diff --git a/contrib/openldap b/contrib/openldap index 4231bbb7..e4bbba1f 100644 --- a/contrib/openldap +++ b/contrib/openldap @@ -16,8 +16,7 @@ _ldapsearch() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -h) @@ -64,8 +63,7 @@ _ldapaddmodify() local cur prev options COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -h) @@ -102,8 +100,7 @@ _ldapdelete() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -h) @@ -136,8 +133,7 @@ _ldapcompare() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -h) @@ -170,8 +166,7 @@ _ldapmodrdn() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -h) @@ -204,8 +199,7 @@ _ldapwhoami() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -h) @@ -238,8 +232,7 @@ _ldappasswd() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -h) diff --git a/contrib/openssl b/contrib/openssl index 2db79de2..568f2dbf 100644 --- a/contrib/openssl +++ b/contrib/openssl @@ -32,7 +32,7 @@ _openssl() local cur prev commands command options formats COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur prev commands='asn1parse ca ciphers crl crl2pkcs7 dgst dh dhparam dsa \ dsaparam ec ecparam enc engine errstr gendh gendsa genrsa \ @@ -53,7 +53,6 @@ _openssl() COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) else command=${COMP_WORDS[1]} - prev=${COMP_WORDS[COMP_CWORD-1]} case $prev in -CA|-CAfile|-CAkey|-CAserial|-cert|-certfile|-config|-content| \ -dcert|-dkey|-dhparam|-extfile|-in|-inkey|-kfile|-key|-keyout| \ @@ -6,8 +6,7 @@ _p4() local cur prev preprev p4commands p4filetypes COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev preprev # rename isn't really a command p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )" @@ -31,7 +30,6 @@ _p4() ;; esac elif [ $COMP_CWORD -gt 2 ]; then - preprev=${COMP_WORDS[COMP_CWORD-2]} case $prev in -t) case $preprev in diff --git a/contrib/perl b/contrib/perl index ab8877b0..e9e7e46e 100644 --- a/contrib/perl +++ b/contrib/perl @@ -14,8 +14,7 @@ _perl() local optPrefix optSuffix COMPREPLY=() - cur=`_get_cword :` - prev=`_get_pword :` + _get_comp_words_by_ref -n : cur prev prefix="" # If option not followed by whitespace, reassign prev and cur @@ -55,8 +54,7 @@ _perldoc() local cur prev prefix temp COMPREPLY=() - cur=`_get_cword :` - prev=`_get_pword :` + _get_comp_words_by_ref -n : cur prev prefix="" # completing an option (may or may not be separated by a space) diff --git a/contrib/pine b/contrib/pine index 7335635d..2f069287 100644 --- a/contrib/pine +++ b/contrib/pine @@ -6,7 +6,7 @@ _pineaddr() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook \ 2>/dev/null)' -- "$cur" ) ) diff --git a/contrib/pkg-config b/contrib/pkg-config index 78729604..b999bd81 100644 --- a/contrib/pkg-config +++ b/contrib/pkg-config @@ -6,8 +6,7 @@ _pkg_config() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/pkg_install b/contrib/pkg_install index 562596cd..577d9c94 100644 --- a/contrib/pkg_install +++ b/contrib/pkg_install @@ -8,8 +8,7 @@ _pkg_delete() local cur pkgdir prev pkgdir=${PKG_DBDIR:-/var/db/pkg}/ - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev [[ "$prev" == -o || "$prev" == -p || "$prev" == -W ]] && return 0 diff --git a/contrib/pkgtools b/contrib/pkgtools index 4a6b068c..eb76cb9d 100644 --- a/contrib/pkgtools +++ b/contrib/pkgtools @@ -6,7 +6,7 @@ _removepkg() local packages cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) ) } && diff --git a/contrib/pm-utils b/contrib/pm-utils index 85d4f21c..4deb82e7 100644 --- a/contrib/pm-utils +++ b/contrib/pm-utils @@ -3,7 +3,8 @@ have pm-is-supported && _pm_is_supported() { - local cur=`_get_cword` + local cur + _get_comp_words_by_ref cur COMPREPLY=( $( compgen -W '--help --suspend --hibernate --suspend-hybrid' \ -- "$cur" ) ) } && @@ -12,7 +13,8 @@ complete -F _pm_is_supported pm-is-supported have pm-hibernate || have pm-suspend || have pm-suspend-hybrid && _pm_action() { - local cur=`_get_cword` + local cur + _get_comp_words_by_ref cur COMPREPLY=( $( compgen -W "--help $( _parse_help "$1" )" -- "$cur" ) ) } && complete -F _pm_action pm-hibernate pm-suspend pm-suspend-hybrid @@ -20,7 +22,8 @@ complete -F _pm_action pm-hibernate pm-suspend pm-suspend-hybrid have pm-powersave && _pm_powersave() { - local cur=`_get_cword` + local cur + _get_comp_words_by_ref cur COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) } && complete -F _pm_powersave pm-powersave diff --git a/contrib/portupgrade b/contrib/portupgrade index d66fca90..5389a5ca 100644 --- a/contrib/portupgrade +++ b/contrib/portupgrade @@ -6,8 +6,7 @@ _portupgrade() local cur pkgdir prev pkgdir=${PKG_DBDIR:-/var/db/pkg}/ - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev [[ "$prev" == -l || "$prev" == -L || "$prev" == -o ]] && return 0 @@ -26,8 +25,7 @@ _portinstall() local -a COMPREPLY2 portsdir=${PORTSDIR:-/usr/ports}/ - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev # First try INDEX-5 indexfile=$portsdir/INDEX-5 # Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x diff --git a/contrib/postfix b/contrib/postfix index 2a650511..ec91c1a3 100644 --- a/contrib/postfix +++ b/contrib/postfix @@ -8,8 +8,7 @@ _postfix() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -c) @@ -39,8 +38,7 @@ _postmap() local cur prev len idx COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -c) @@ -84,8 +82,7 @@ _postcat() local cur prev pval len idx qfile COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -c) @@ -128,8 +125,7 @@ _postconf() local cur prev pval len idx eqext COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -b|-t) @@ -171,8 +167,7 @@ _postsuper() local cur prev pval len idx COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -c) diff --git a/contrib/postgresql b/contrib/postgresql index 57b4c2df..392c9aa6 100644 --- a/contrib/postgresql +++ b/contrib/postgresql @@ -25,8 +25,7 @@ _createdb() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -68,8 +67,7 @@ _dropdb() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -106,8 +104,7 @@ _psql() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/povray b/contrib/povray index b98c0819..cd03b940 100644 --- a/contrib/povray +++ b/contrib/povray @@ -7,8 +7,7 @@ _povray() defoext=png # default output extension, if cannot be determined FIXME COMPREPLY=() - povcur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref povcur prev _expand || return 0 diff --git a/contrib/python b/contrib/python index 3d28f98c..9d8fcc9d 100644 --- a/contrib/python +++ b/contrib/python @@ -6,8 +6,7 @@ _python() local prev cur i COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]##*/} + _get_comp_words_by_ref cur prev case $prev in -Q) diff --git a/contrib/qdbus b/contrib/qdbus index e153a761..879df68d 100644 --- a/contrib/qdbus +++ b/contrib/qdbus @@ -6,7 +6,8 @@ _qdbus() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur + [ -n "$cur" ] && unset COMP_WORDS[${#COMP_WORDS[@]}-1] COMPREPLY=( $( compgen -W '$( command ${COMP_WORDS[@]} 2>/dev/null | \ sed s/\(.*\)// )' -- "$cur" ) ) diff --git a/contrib/qemu b/contrib/qemu index 4910bd95..1c7a8da0 100644 --- a/contrib/qemu +++ b/contrib/qemu @@ -6,8 +6,7 @@ _qemu() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -fd[ab]|-hd[abcd]|-cdrom|-option-rom|-kernel|-initrd|-bootp|-pidfile| \ diff --git a/contrib/quota-tools b/contrib/quota-tools index 77dbe531..2b528d92 100644 --- a/contrib/quota-tools +++ b/contrib/quota-tools @@ -35,8 +35,7 @@ _quota() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -65,8 +64,7 @@ _setquota() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -105,8 +103,7 @@ _edquota() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -138,8 +135,7 @@ _quotacheck() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -168,8 +164,7 @@ _repquota() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -198,8 +193,7 @@ _quotaon() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -226,8 +220,7 @@ _quotaoff() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/rcs b/contrib/rcs index 36ebaa5a..42ac8d5a 100644 --- a/contrib/rcs +++ b/contrib/rcs @@ -6,8 +6,7 @@ _rcs() local cur prev file dir i COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev file=${cur##*/} dir=${cur%/*} diff --git a/contrib/rdesktop b/contrib/rdesktop index 799d5459..7acf47a5 100644 --- a/contrib/rdesktop +++ b/contrib/rdesktop @@ -6,8 +6,7 @@ _rdesktop() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -k) diff --git a/contrib/reportbug b/contrib/reportbug index 1e5b4d5d..ada0cc3c 100644 --- a/contrib/reportbug +++ b/contrib/reportbug @@ -6,8 +6,7 @@ _reportbug() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -f|--filename|-i|--include|--mta|-o|--output) @@ -86,8 +85,7 @@ _querybts() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/resolvconf b/contrib/resolvconf index 92c2da41..9773696d 100644 --- a/contrib/resolvconf +++ b/contrib/resolvconf @@ -6,8 +6,7 @@ _resolvconf() local cur command COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -a|-d) diff --git a/contrib/rfkill b/contrib/rfkill index ec331e0d..5c51ff9d 100644 --- a/contrib/rfkill +++ b/contrib/rfkill @@ -6,7 +6,7 @@ _rfkill() local cur prev COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur prev if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--version' -- "$cur" ) ) @@ -17,7 +17,6 @@ _rfkill() -- "$cur" ) ) ;; 2) - prev=${COMP_WORDS[COMP_CWORD-1]} if [[ $prev == block || $prev == unblock ]]; then COMPREPLY=( $( compgen -W "$(rfkill list | awk -F: \ '/^[0-9]/ {print $1}') all wifi bluetooth uwb wimax \ @@ -38,7 +38,7 @@ _ri() local -a classes COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur ri_path=$(type -p ri) # which version of ri are we using? diff --git a/contrib/rpcdebug b/contrib/rpcdebug index 525ab7d7..be2a8709 100644 --- a/contrib/rpcdebug +++ b/contrib/rpcdebug @@ -24,8 +24,7 @@ _rpcdebug() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -s) diff --git a/contrib/rpm b/contrib/rpm index ca5fe311..20f98522 100644 --- a/contrib/rpm +++ b/contrib/rpm @@ -55,8 +55,7 @@ _rpm() local cur prev opts nodig nosig COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev nodig="" nosig="" _rpm_nodigsig diff --git a/contrib/rpmcheck b/contrib/rpmcheck index 49240fd1..5d9aada7 100644 --- a/contrib/rpmcheck +++ b/contrib/rpmcheck @@ -6,8 +6,7 @@ _rpmcheck() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -base) diff --git a/contrib/rrdtool b/contrib/rrdtool index 891df683..0b15a23f 100644 --- a/contrib/rrdtool +++ b/contrib/rrdtool @@ -3,7 +3,9 @@ have rrdtool && _rrdtool () { - cur=`_get_cword` + local cur + _get_comp_words_by_ref cur + COMPREPLY=( $( compgen -W 'create update updatev graph dump restore last \ lastupdate first info fetch tune resize xport' -- "$cur" ) ) } && diff --git a/contrib/rsync b/contrib/rsync index 6fef52b4..1c37ec24 100644 --- a/contrib/rsync +++ b/contrib/rsync @@ -6,8 +6,8 @@ _rsync() # TODO: _split_longopt COMPREPLY=() - local cur=`_get_cword :` - local prev=`_get_pword :` + local cur prev + _get_comp_words_by_ref -n : cur prev _expand || return 0 diff --git a/contrib/rtcwake b/contrib/rtcwake index 0169fb61..c95c1d76 100644 --- a/contrib/rtcwake +++ b/contrib/rtcwake @@ -4,7 +4,8 @@ have rtcwake && _rtcwake() { COMPREPLY=() - local cur=`_get_cword` prev=`_get_pword` split=false + local cur prev split=false + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/samba b/contrib/samba index 9c7651f2..61d78abc 100644 --- a/contrib/samba +++ b/contrib/samba @@ -32,8 +32,7 @@ _smbclient() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -99,8 +98,7 @@ _smbget() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -132,8 +130,7 @@ _smbcacls() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -166,8 +163,7 @@ _smbcquotas() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -201,8 +197,7 @@ _smbpasswd() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -r) @@ -235,8 +230,7 @@ _smbtar() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -r|-t) @@ -265,8 +259,7 @@ _smbtree() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/sbcl b/contrib/sbcl index 5dfc6723..a43ec1fc 100644 --- a/contrib/sbcl +++ b/contrib/sbcl @@ -7,7 +7,7 @@ _sbcl() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur # completing an option (may or may not be separated by a space) if [[ "$cur" == -* ]]; then diff --git a/contrib/screen b/contrib/screen index faed765a..a0df1227 100644 --- a/contrib/screen +++ b/contrib/screen @@ -19,10 +19,7 @@ _screen() local cur prev preprev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} - - [ "$COMP_CWORD" -ge 2 ] && preprev=${COMP_WORDS[COMP_CWORD-2]} + _get_comp_words_by_ref cur prev preprev case $preprev in -[dD]) diff --git a/contrib/shadow b/contrib/shadow index 3e19e638..a3451b7b 100644 --- a/contrib/shadow +++ b/contrib/shadow @@ -6,8 +6,7 @@ _useradd() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -57,8 +56,7 @@ _usermod() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -106,7 +104,7 @@ _userdel() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--force --help --remove' -- "$cur" ) ) @@ -123,8 +121,7 @@ _chage() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -152,8 +149,7 @@ _passwd() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -n|-x|-w|-i|-\?|--help|--usage) @@ -177,8 +173,7 @@ _chpasswd() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -209,8 +204,7 @@ _newusers() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -243,7 +237,7 @@ _pwck() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-q -r -s' -- "$cur" ) ) @@ -260,8 +254,7 @@ _groupadd() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -290,8 +283,7 @@ _groupmod() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -334,8 +326,7 @@ _gpasswd() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -a|-d|-A|-M) @@ -359,8 +350,7 @@ _groupmems() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -a|-d) @@ -386,7 +376,7 @@ _grpck() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-r -s' -- "$cur" ) ) @@ -403,8 +393,7 @@ _vipw() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -h|--help) @@ -426,8 +415,7 @@ _faillog() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true @@ -457,8 +445,7 @@ _lastlog() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/sitecopy b/contrib/sitecopy index 1c980566..616bc5e4 100644 --- a/contrib/sitecopy +++ b/contrib/sitecopy @@ -8,7 +8,7 @@ _sitecopy() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur case $cur in --*) diff --git a/contrib/smartctl b/contrib/smartctl index 883b4ca6..74e42816 100644 --- a/contrib/smartctl +++ b/contrib/smartctl @@ -67,8 +67,7 @@ _smartctl() local cur prev split=false COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev _split_longopt && split=true diff --git a/contrib/snownews b/contrib/snownews index 4430ce81..9c99ed7c 100644 --- a/contrib/snownews +++ b/contrib/snownews @@ -6,7 +6,7 @@ _snownews() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then # return list of available options diff --git a/contrib/ssh b/contrib/ssh index 37831bb6..229ca2ad 100644 --- a/contrib/ssh +++ b/contrib/ssh @@ -118,8 +118,9 @@ _ssh() local -a config COMPREPLY=() - cur=`_get_cword :` - prev=`_get_pword` + _get_comp_words_by_ref -n : cur prev + #cur=`_get_cword :` + #prev=`_get_pword` _ssh_suboption_check && return 0 @@ -196,8 +197,7 @@ _sftp() local cur prev configfile COMPREPLY=() - cur=`_get_cword` - prev=`_get_pword` + _get_comp_words_by_ref cur prev _ssh_suboption_check && return 0 @@ -314,8 +314,7 @@ _scp() local configfile cur prev prefix COMPREPLY=() - cur=`_get_cword ":"` - prev=`_get_pword ":"` + _get_comp_words_by_ref -n : cur prev _ssh_suboption_check && { COMPREPLY=( "${COMPREPLY[@]/%/ }" ) @@ -397,8 +396,7 @@ _ssh_copy_id() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=`_get_pword` + _get_comp_words_by_ref cur prev case $prev in -i) diff --git a/contrib/sshfs b/contrib/sshfs index 78bf11d2..d7945f88 100644 --- a/contrib/sshfs +++ b/contrib/sshfs @@ -6,7 +6,7 @@ _sshfs() local cur userhost path COMPREPLY=() - cur=`_get_cword ":"` + _get_comp_words_by_ref -n : cur _expand || return 0 diff --git a/contrib/strace b/contrib/strace index 4011303a..9b3e2676 100644 --- a/contrib/strace +++ b/contrib/strace @@ -27,8 +27,7 @@ _strace() else COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -e) diff --git a/contrib/svk b/contrib/svk index 06d86fd7..c809d2eb 100644 --- a/contrib/svk +++ b/contrib/svk @@ -6,7 +6,7 @@ _svk() local cur prev commands options command COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur prev commands='add admin annotate ann blame praise cat checkout co cleanup \ cmerge cm commit ci copy cp delete del remove rm depotmap \ @@ -23,8 +23,6 @@ _svk() COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) fi else - - prev=${COMP_WORDS[COMP_CWORD-1]} case $prev in -F|--file|--targets) _filedir diff --git a/contrib/sysctl b/contrib/sysctl index cd40c453..41cbd7ee 100644 --- a/contrib/sysctl +++ b/contrib/sysctl @@ -6,7 +6,7 @@ _sysctl() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur COMPREPLY=( $( compgen -W "$(sysctl -N -a 2>/dev/null)" -- "$cur" ) ) diff --git a/contrib/sysv-rc b/contrib/sysv-rc index c04c3182..735a4042 100644 --- a/contrib/sysv-rc +++ b/contrib/sysv-rc @@ -7,8 +7,7 @@ _update_rc_d() { local cur prev sysvdir services options valid_options - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \ || sysvdir=/etc/init.d @@ -72,8 +71,7 @@ _invoke_rc_d() { local cur prev sysvdir services options valid_options - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \ || sysvdir=/etc/init.d diff --git a/contrib/tar b/contrib/tar index 5bc99893..db6e7c9c 100644 --- a/contrib/tar +++ b/contrib/tar @@ -6,7 +6,7 @@ _tar() local cur ext regex tar untar COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $( compgen -W 'c t x u r d A' -- "$cur" ) ) diff --git a/contrib/tcpdump b/contrib/tcpdump index 094897f8..259f13e0 100644 --- a/contrib/tcpdump +++ b/contrib/tcpdump @@ -6,8 +6,7 @@ _tcpdump() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -r|-w|-F) diff --git a/contrib/unace b/contrib/unace index 7d065c01..5ceb7646 100644 --- a/contrib/unace +++ b/contrib/unace @@ -6,8 +6,7 @@ _unace() local cur COMPREPLY=() - cur=`_get_cword` - + _get_comp_words_by_ref cur if [[ "$cur" == -* ]] ; then COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- "$cur" ) ) diff --git a/contrib/unrar b/contrib/unrar index 278b6a7b..3fb24dbb 100644 --- a/contrib/unrar +++ b/contrib/unrar @@ -6,7 +6,7 @@ _unrar() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]] ; then COMPREPLY=( $( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu \ diff --git a/contrib/update-alternatives b/contrib/update-alternatives index b04a5c5c..ebed294d 100644 --- a/contrib/update-alternatives +++ b/contrib/update-alternatives @@ -22,8 +22,7 @@ _update_alternatives() local cur prev mode args i COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --altdir|--admindir) diff --git a/contrib/vncviewer b/contrib/vncviewer index 0701929e..296eb8af 100644 --- a/contrib/vncviewer +++ b/contrib/vncviewer @@ -23,8 +23,7 @@ _tightvncviewer() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -passwd) @@ -65,8 +64,7 @@ _xvnc4viewer() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev # Convert double dash to single dash case ${prev/#--/-} in diff --git a/contrib/vpnc b/contrib/vpnc index 3b1ac072..722fee3a 100644 --- a/contrib/vpnc +++ b/contrib/vpnc @@ -6,8 +6,7 @@ _vpnc() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --pfs) diff --git a/contrib/wireless-tools b/contrib/wireless-tools index 0f034e7e..56ba0db8 100644 --- a/contrib/wireless-tools +++ b/contrib/wireless-tools @@ -9,8 +9,7 @@ _iwconfig() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in mode) @@ -101,8 +100,7 @@ _iwlist() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev if [ $COMP_CWORD -eq 1 ]; then if [[ "$cur" == -* ]]; then @@ -125,7 +123,7 @@ _iwspy() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [ $COMP_CWORD -eq 1 ]; then if [[ "$cur" == -* ]]; then @@ -146,8 +144,7 @@ _iwpriv() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in roam) diff --git a/contrib/wodim b/contrib/wodim index ada800c6..5fa69a8b 100644 --- a/contrib/wodim +++ b/contrib/wodim @@ -6,8 +6,7 @@ _cdrecord() local cur prev i generic_options track_options track_mode COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev # foo=bar style option if [[ "$cur" == *=* ]]; then diff --git a/contrib/wtf b/contrib/wtf index 56d0d2e0..2b6c4d01 100644 --- a/contrib/wtf +++ b/contrib/wtf @@ -7,8 +7,7 @@ _wtf() local cur prev db COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev [ "$prev" = -f ] && _filedir && return 0 [[ "$cur" == -* ]] && COMPREPLY=( -f ) && return 0 diff --git a/contrib/wvdial b/contrib/wvdial index 10d9c2ca..101112ca 100644 --- a/contrib/wvdial +++ b/contrib/wvdial @@ -6,8 +6,7 @@ _wvdial() local cur prev config i IFS=$'\t\n' COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --config) diff --git a/contrib/xhost b/contrib/xhost index 570c9861..36ddb09a 100644 --- a/contrib/xhost +++ b/contrib/xhost @@ -3,7 +3,8 @@ have xhost && _xhost () { - local cur=`_get_cword` + local cur + _get_comp_words_by_ref cur case $cur in +*) _known_hosts_real -p+ "${cur:1}" ;; @@ -20,7 +20,7 @@ _xm() local cur prev command options COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur prev commands='console create new delete destroy domid domname dump-core \ list mem-max mem-set migrate pause reboot rename restore \ @@ -35,7 +35,6 @@ _xm() if [[ $COMP_CWORD -eq 1 ]] ; then COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) ) else - prev=${COMP_WORDS[COMP_CWORD-1]} if [[ "$cur" == *=* ]]; then prev=${cur/=*/} cur=${cur/*=/} diff --git a/contrib/xmllint b/contrib/xmllint index ef41596d..82feb4a3 100644 --- a/contrib/xmllint +++ b/contrib/xmllint @@ -6,8 +6,7 @@ _xmllint() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -o|--output) diff --git a/contrib/xmlwf b/contrib/xmlwf index 6d926fde..7109bcd3 100644 --- a/contrib/xmlwf +++ b/contrib/xmlwf @@ -6,8 +6,7 @@ _xmlwf() local cur prev COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in -d) diff --git a/contrib/xmms b/contrib/xmms index 4559c3c7..42c5402c 100644 --- a/contrib/xmms +++ b/contrib/xmms @@ -6,7 +6,7 @@ _xmms() local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '-h --help -r --rew -p --play \ diff --git a/contrib/xrandr b/contrib/xrandr index 08c9e847..70de80f7 100644 --- a/contrib/xrandr +++ b/contrib/xrandr @@ -5,8 +5,7 @@ _xrandr() { local cur prev output modes COMPREPLY=() - cur=`_get_cword` - prev=${COMP_WORDS[COMP_CWORD-1]} + _get_comp_words_by_ref cur prev case $prev in --output) diff --git a/contrib/xsltproc b/contrib/xsltproc index 3576f980..f71d3f11 100644 --- a/contrib/xsltproc +++ b/contrib/xsltproc @@ -5,8 +5,7 @@ _xsltproc() { local cur prev COMPREPLY=() - cur=`_get_cword` - prev=`_get_pword` + _get_comp_words_by_ref cur prev case $prev in --output|-o) @@ -4,8 +4,8 @@ have xz && _xz() { COMPREPLY=() - local cur=`_get_cword` - local prev=${COMP_WORDS[COMP_CWORD-1]} + local cur prev + _get_comp_words_by_ref cur prev if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--compress --decompress --test --list \ @@ -64,8 +64,8 @@ have xzdec && _xzdec() { COMPREPLY=() - local cur=`_get_cword` - local prev=${COMP_WORDS[COMP_CWORD-1]} + local cur prev + _get_comp_words_by_ref cur prev if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--memory --help --version' -- "$cur" ) ) diff --git a/contrib/yp-tools b/contrib/yp-tools index 4644ba5b..7252a129 100644 --- a/contrib/yp-tools +++ b/contrib/yp-tools @@ -6,7 +6,7 @@ _ypmatch() local cur map cmd COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur cmd=${1##*/} [[ $cmd == ypcat && $COMP_CWORD -gt 1 ]] && return 0 diff --git a/contrib/yum-arch b/contrib/yum-arch index fe70e77a..3728335c 100644 --- a/contrib/yum-arch +++ b/contrib/yum-arch @@ -5,7 +5,7 @@ _yum_arch() { local cur COMPREPLY=() - cur=`_get_cword` + _get_comp_words_by_ref cur if [[ "$cur" == -* ]] ; then COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- "$cur" ) ) |