[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.90-54-gf0283e1

Igor Murzov e-mail at date.by
Sun Nov 20 13:14:05 UTC 2011


The following commit has been merged in the master branch:
commit f0283e1c1b64202bb1adb9f44eac6fdfd80edece
Author: Igor Murzov <e-mail at date.by>
Date:   Sun Nov 20 17:00:03 2011 +0300

    Cleanups: Make code more compact.
    
    Drop useless spaces, backslashes, return codes, unused arguments etc.

diff --git a/bash_completion b/bash_completion
index 00f72f9..ac5842a 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1625,7 +1625,7 @@ _command_offset()
     for (( i; i <= COMP_CWORD; i++ )); do
         unset COMP_WORDS[i]
     done
-    COMP_CWORD=$(( $COMP_CWORD - $word_offset ))
+    ((COMP_CWORD -= $word_offset))
 
     COMPREPLY=()
     local cur
@@ -1696,7 +1696,7 @@ _root_command()
 {
     local PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
     local root_command=$1
-    _command $1 $2 $3
+    _command
 }
 complete -F _root_command fakeroot gksu gksudo kdesudo really sudo
 
diff --git a/completions/fbgs b/completions/fbgs
index 672de7c..9a24789 100644
--- a/completions/fbgs
+++ b/completions/fbgs
@@ -8,17 +8,17 @@ _fbgs()
     case "$prev" in
         -f)
             local IFS=$'\n'
-            COMPREPLY=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) )
+            COMPREPLY=( $(compgen -W '$(fc-list 2>/dev/null)' -- "$cur") )
             return
             ;;
         -m)
-            COMPREPLY=( $( compgen -W '$( sed \
+            COMPREPLY=( $(compgen -W '$(sed \
                 -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \
-                /etc/fb.modes 2> /dev/null )' -- "$cur" ) )
+                /etc/fb.modes 2> /dev/null)' -- "$cur") )
             return
             ;;
         -d)
-            COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) )
+            COMPREPLY=( $(compgen -f -d -- "${cur:-/dev/}") )
             return
             ;;
         -t|-g|-p)
@@ -28,7 +28,7 @@ _fbgs()
     esac
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $(compgen -W '-l -xl -xxl -a --fitwidth -d -m -t -g -f -p \
+        COMPREPLY=( $(compgen -W '-l -xl -xxl -a --fitwidth -d -m -t -g -f -p
             -h -c' -- "$cur") )
         [[ $COMPREPLY ]] && return
     fi
diff --git a/completions/fbi b/completions/fbi
index f8f7a82..c3bf695 100644
--- a/completions/fbi
+++ b/completions/fbi
@@ -16,17 +16,17 @@ _fbi()
             ;;
         -f|--font)
             local IFS=$'\n'
-            COMPREPLY=( $( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) )
+            COMPREPLY=( $(compgen -W '$(fc-list 2> /dev/null)' -- "$cur") )
             return
             ;;
         -m|--mode)
-            COMPREPLY=( $( compgen -W '$( sed \
+            COMPREPLY=( $(compgen -W '$(sed \
                 -n "/^mode/{s/^mode \{1,\}\"\([^\"]\{1,\}\)\"/\1/g;p}" \
-                /etc/fb.modes 2> /dev/null )' -- "$cur" ) )
+                /etc/fb.modes 2> /dev/null)' -- "$cur") )
             return
             ;;
         -d|--device)
-            COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) )
+            COMPREPLY=( $(compgen -f -d -- "${cur:-/dev/}") )
             return
             ;;
         --cachemem|--blend|-T|--vt|-s|--scroll|-t|--timeout|-g|--gamma)
@@ -36,12 +36,11 @@ _fbi()
     esac
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $(compgen -W '--help --version --store --list --text \
-            --autozoom --autoup --noautoup --autodown --noautodown --fitwidth \
-            --nofitwidth --verbose --noverbose --random --norandom --comments \
-            --nocomments --edit --noedit --backup --nobackup --preserve \
-            --nopreserve --readahead --noreadahead --cachemem --blend --vt \
-            --scroll --timeout --once --noonce --resolution --gamma --font \
+        COMPREPLY=( $(compgen -W '--help --version --store --list --text
+            --autozoom --{,no}autoup --{,no}autodown --{,no}fitwidth
+            --{,no}verbose --{,no}random --{,no}comments --{,no}edit
+            --{,no}backup --{,no}preserve --{,no}readahead --cachemem --blend
+            --vt --scroll --timeout --{,no}once --resolution --gamma --font
             --device --mode' -- "$cur") )
         [[ $COMPREPLY ]] && return
     fi
diff --git a/completions/feh b/completions/feh
index 556fc13..f1487bd 100644
--- a/completions/feh
+++ b/completions/feh
@@ -7,11 +7,11 @@ _feh()
 
     case "$prev" in
         -B|--image-bg)
-            COMPREPLY=( $( compgen -W 'default white black' -- "$cur" ) )
+            COMPREPLY=( $(compgen -W 'default white black' -- "$cur") )
             return
             ;;
         --index-dim|--index-name|--index-size)
-            COMPREPLY=( $( compgen -W '0 1' -- "$cur" ) )
+            COMPREPLY=( $(compgen -W '0 1' -- "$cur") )
             return
             ;;
         -f|--filelist|-o|--output|-O|--output-only|-\||--start-at)
@@ -51,13 +51,13 @@ _feh()
                 if [[ "$theme_name" == '#'* || "$theme_name" == "" ]]; then
                     continue
                 fi
-                COMPREPLY+=( $( compgen -W "$theme_name" -- "$cur" ) )
+                COMPREPLY+=( $(compgen -W "$theme_name" -- "$cur") )
             done < "$conf_path"
             return
             ;;
         -S|--sort)
-            COMPREPLY=( $( compgen -W 'name filename width height pixels size
-                format' -- "$cur" ) )
+            COMPREPLY=( $(compgen -W 'name filename width height pixels size
+                format' -- "$cur") )
             return
             ;;
         -R|--reload|-H|--limit-height|-W|--limit-width|-E|--thumb-height|\
@@ -78,16 +78,16 @@ _feh()
             ;;
         -0|--reload-button|-1|--pan-button|-2|--zoom-button|-3|--menu-button|\
         -4|--prev-button|-5|--next-button|-8|--rotate-button|-9|--blur-button)
-            COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) )
+            COMPREPLY=( $(compgen -W '{0..9}' -- "$cur") )
             return
             ;;
         -a|--alpha)
-            COMPREPLY=( $( compgen -W '{0..255}' -- "$cur" ) )
+            COMPREPLY=( $(compgen -W '{0..255}' -- "$cur") )
             return
             ;;
         -b|--bg)
             _filedir
-            COMPREPLY+=( $( compgen -W 'trans' -- "$cur" ) )
+            COMPREPLY+=( $(compgen -W 'trans' -- "$cur") )
             return
             ;;
         -g|--geometry)
@@ -108,7 +108,7 @@ _feh()
     $split && return
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
+        COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help)' -- "$cur") )
         [[ $COMPREPLY == *= ]] && compopt -o nospace
         [[ $COMPREPLY ]] && return
     fi
diff --git a/completions/kcov b/completions/kcov
index e0f37fd..690a2a3 100644
--- a/completions/kcov
+++ b/completions/kcov
@@ -8,29 +8,29 @@ _kcov()
     case "$prev" in
         --pid|-p)
             _pids
-            return 0
+            return
             ;;
         --sort-type|-s)
-            COMPREPLY=( $( compgen -W 'filename percentage' -- "$cur" ) )
-            return 0
+            COMPREPLY=( $(compgen -W 'filename percentage' -- "$cur") )
+            return
             ;;
         --include-path|--exclude-path)
             _filedir
-            return 0
+            return
             ;;
         --limits|-l|--title|-t|--include-pattern|--exclude-pattern|\
         --path-strip-level)
             # argument required but no completions available
-            return 0
+            return
             ;;
     esac
 
-    $split && return 0
+    $split && return
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
+        COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help)' -- "$cur") )
         [[ $COMPREPLY == *= ]] && compopt -o nospace
-        return 0
+        return
     fi
 
     _filedir
diff --git a/completions/pgrep b/completions/pgrep
index 87df1a1..5ec27ec 100644
--- a/completions/pgrep
+++ b/completions/pgrep
@@ -24,7 +24,7 @@ _pgrep()
     esac
 
     if [[ $cur == -* ]]; then
-        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
+        COMPREPLY=( $(compgen -W '$( _parse_usage "$1" )' -- "$cur") )
         return
     fi
 
diff --git a/completions/removepkg b/completions/removepkg
index 2fb7986..3c4d12e 100644
--- a/completions/removepkg
+++ b/completions/removepkg
@@ -4,20 +4,19 @@ _removepkg()
 {
     local cur prev words cword
     _init_completion || return
-    if [[ $cur == -* ]]; then
-        COMPREPLY=( $( compgen -W '-copy -keep -preserve -warn' \
-            -- "$cur" ) )
-        return 0
+    if [[ "$cur" == -* ]]; then
+        COMPREPLY=( $(compgen -W '-copy -keep -preserve -warn' -- "$cur") )
+        return
     fi
 
-    if [[ $cur == */* ]]; then
+    if [[ "$cur" == */* ]]; then
         _filedir
-        return 0
+        return
     fi
 
     local root=${ROOT:-/}
-    COMPREPLY=( $( cd "$root/var/log/packages" 2> /dev/null || return 1 ; \
-        compgen -f -- "$cur" ) )
+    COMPREPLY=( $(cd "$root/var/log/packages" 2> /dev/null || return 1; \
+        compgen -f -- "$cur") )
 } &&
 complete -F _removepkg removepkg
 
diff --git a/completions/rpm2tgz b/completions/rpm2tgz
index 0b4510c..211c3b6 100644
--- a/completions/rpm2tgz
+++ b/completions/rpm2tgz
@@ -6,11 +6,11 @@ _rpm2tgz()
     _init_completion || return
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '-s -S -n -r -d -c' -- "$cur" ) )
-        return 0
+        COMPREPLY=( $(compgen -W '-s -S -n -r -d -c' -- "$cur") )
+        return
     fi
 
-    COMPREPLY=( $(compgen -f -X "!*.rpm" -- "$cur") )
-} && complete -F _rpm2tgz -o plusdirs rpm2tgz rpm2txz rpm2targz
+    _filedir "rpm"
+} && complete -F _rpm2tgz rpm2tgz rpm2txz rpm2targz
 
 # ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/sbopkg b/completions/sbopkg
index d0bf9a2..485a13b 100644
--- a/completions/sbopkg
+++ b/completions/sbopkg
@@ -6,33 +6,33 @@ _sbopkg()
     _init_completion || return
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '-b -c -d -e -f -g -h -i -k -l \
-                      -o -P -p -q -R -r -s -u -V -v' -- "$cur" ) )
-        return 0
+        COMPREPLY=( $(compgen -W '-b -c -d -e -f -g -h -i -k -l -o
+            -P -p -q -R -r -s -u -V -v' -- "$cur") )
+        return
     fi
 
     case "$prev" in
         -e)
-            COMPREPLY=( $( compgen -W 'ask continue stop' -- "$cur" ) )
-            return 0
+            COMPREPLY=( $(compgen -W 'ask continue stop' -- "$cur") )
+            return
             ;;
         -f)
             _filedir
-            return 0
+            return
             ;;
         -d)
             _filedir -d
-            return 0
+            return
             ;;
         -V)
-            COMPREPLY=( $( compgen -W "? \
-                $(sbopkg -V ? 2>&1 | cut -s -f1)" -- "$cur" ) )
-            return 0
+            COMPREPLY=( $(compgen -W "? \
+                $(sbopkg -V ? 2>&1 | cut -s -f1)" -- "$cur") )
+            return
             ;;
         -i|-b)
             ;;
         *)
-            return 0
+            return
             ;;
     esac
 
@@ -45,8 +45,8 @@ _sbopkg()
         fi
     done
 
-    if [[ ! -r $config ]]; then
-        return 0
+    if [[ ! -r "$config" ]]; then
+        return
     fi
 
     . $config
@@ -64,11 +64,11 @@ _sbopkg()
     done
 
     if [[ ! -r $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT ]]; then
-        return 0
+        return
     fi
-    COMPREPLY=( $( sed -ne "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}"\
-        $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT )
-        $( cd $QUEUEDIR; compgen -f -X "!*.sqf"  -- "$cur" ) )
+    COMPREPLY=( $(sed -ne "/^SLACKBUILD NAME: $cur/{s/^SLACKBUILD NAME: //;p}"\
+        $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT)
+        $(cd $QUEUEDIR; compgen -f -X "!*.sqf"  -- "$cur") )
 } && complete -F _sbopkg sbopkg
 
 # ex: ts=4 sw=4 et filetype=sh
diff --git a/completions/slackpkg b/completions/slackpkg
index 9648d25..cc409ce 100644
--- a/completions/slackpkg
+++ b/completions/slackpkg
@@ -16,35 +16,35 @@ _slackpkg()
     case "$prev" in
         -delall|-checkmd5|-checkgpg|-checksize|-postinst|-onoff|-download_all|\
         -dialog|-batch|-only_new_dotnew|-use_includes|-spinning)
-            COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
-            return 0
+            COMPREPLY=( $(compgen -W 'on off' -- "$cur") )
+            return
             ;;
         -default_answer)
-            COMPREPLY=( $( compgen -W 'yes no' -- "$cur" ) )
-            return 0
+            COMPREPLY=( $(compgen -W 'yes no' -- "$cur") )
+            return
             ;;
         -dialog_maxargs|-mirror)
             # argument required but no completions available
-            return 0
+            return
             ;;
     esac
 
-    $split && return 0
+    $split && return
 
     if [[ "$cur" == -* ]]; then
         compopt -o nospace
-        COMPREPLY=( $( compgen -W '-delall= -checkmd5= -checkgpg= \
-            -checksize= -postinst= -onoff= -download_all= -dialog= \
-            -dialog_maxargs= -batch= -only_new_dotnew= -use_includes= \
-            -spinning= -default_answer= -mirror=' -- "$cur" ) )
-        return 0
+        COMPREPLY=( $(compgen -W '-delall= -checkmd5= -checkgpg=
+            -checksize= -postinst= -onoff= -download_all= -dialog=
+            -dialog_maxargs= -batch= -only_new_dotnew= -use_includes=
+            -spinning= -default_answer= -mirror=' -- "$cur") )
+        return
     fi
 
     local confdir="/etc/slackpkg"
     local config="$confdir/slackpkg.conf"
 
-    if [[ ! -r $config ]]; then
-        return 0
+    if [[ ! -r "$config" ]]; then
+        return
     fi
     . "$config"
 
@@ -59,47 +59,47 @@ _slackpkg()
     case "$action" in
         generate-template|search|file-search)
             # argument required but no completions available
-            return 0
+            return
             ;;
         install-template|remove-template)
             if [[ -e $confdir/templates ]]; then
-                COMPREPLY=( $( cd "$confdir/templates"; \
-                    compgen -f -X "!*.template" -- "$cur" ) )
+                COMPREPLY=( $(cd "$confdir/templates"; \
+                    compgen -f -X "!*.template" -- "$cur") )
                 COMPREPLY=( ${COMPREPLY[@]%.template} )
             fi
-            return 0
+            return
             ;;
         remove)
             _filedir
-            COMPREPLY+=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x \
-                xap y' -- "$cur" ) )
-            COMPREPLY+=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
-            return 0
+            COMPREPLY+=( $(compgen -W 'a ap d e f k kde kdei l n t tcl x
+                xap y' -- "$cur") )
+            COMPREPLY+=( $(cd /var/log/packages; compgen -f -- "$cur") )
+            return
             ;;
         install|reinstall|upgrade|blacklist|download)
             _filedir
-            COMPREPLY+=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x \
-                xap y' -- "$cur" ) )
-            COMPREPLY+=( $( cut -f 6 -d\  ${WORKDIR}/pkglist 2> /dev/null | \
-                grep "^$cur" ) )
-            return 0
+            COMPREPLY+=( $(compgen -W 'a ap d e f k kde kdei l n t tcl x
+                xap y' -- "$cur") )
+            COMPREPLY+=( $(cut -f 6 -d\  "${WORKDIR}/pkglist" 2> /dev/null | \
+                grep "^$cur") )
+            return
             ;;
         info)
-            COMPREPLY+=( $( cut -f 6 -d\  ${WORKDIR}/pkglist 2> /dev/null | \
-                grep "^$cur" ) )
-            return 0
+            COMPREPLY=( $(cut -f 6 -d\  "${WORKDIR}/pkglist" 2> /dev/null | \
+                grep "^$cur") )
+            return
             ;;
         update)
             # we should complete the same as the next `list` + "gpg"
-            COMPREPLY=( $( compgen -W 'gpg' -- "$cur" ) )
+            COMPREPLY=( $(compgen -W 'gpg' -- "$cur") )
             ;&
         *)
-            COMPREPLY+=( $( compgen -W 'install reinstall upgrade remove \
-                blacklist download update install-new upgrade-all \
-                clean-system new-config check-updates help generate-template \
+            COMPREPLY+=( $(compgen -W 'install reinstall upgrade remove
+                blacklist download update install-new upgrade-all
+                clean-system new-config check-updates help generate-template
                 install-template remove-template search file-search info' -- \
-                "$cur" ) )
-            return 0
+                "$cur") )
+            return
             ;;
     esac
 
diff --git a/completions/slapt-get b/completions/slapt-get
index d18695c..28e6ee9 100644
--- a/completions/slapt-get
+++ b/completions/slapt-get
@@ -8,18 +8,18 @@ _slapt_get()
     case "$prev" in
         --config|-c)
             _filedir
-            return 0
+            return
             ;;
         --retry|--search)
             # argument required but no completions available
-            return 0
+            return
             ;;
     esac
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
+        COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help)' -- "$cur") )
         [[ $COMPREPLY == *= ]] && compopt -o nospace
-        [[ $COMPREPLY ]] && return 0
+        [[ $COMPREPLY ]] && return
     fi
 
     local i t
@@ -48,7 +48,7 @@ _slapt_get()
             break
         fi
     done
-    if [[ ! -r $config ]]; then
+    if [[ ! -r "$config" ]]; then
         return
     fi
 
@@ -57,23 +57,23 @@ _slapt_get()
             # slapt-get will fail to search for "^name-version"
             # it can search for names only
             local name=${cur%%-*}
-            COMPREPLY=( $( slapt-get -c $config --search "^$name" 2>/dev/null |\
-                sed -ne "/^$cur/{s/ .*$//;p}" ) )
-            return 0
+            COMPREPLY=( $(slapt-get -c $config --search "^$name" 2>/dev/null |\
+                sed -ne "/^$cur/{s/ .*$//;p}") )
+            return
             ;;
         avl) # --install|-i|
-            COMPREPLY=( $( slapt-get -c $config --available 2>/dev/null | \
+            COMPREPLY=( $(slapt-get -c $config --available 2>/dev/null | \
                 sed -ne "/^$cur/{s/ .*$//;p}") )
-            return 0
+            return
             ;;
         ins) # --remove|--filelist
-            COMPREPLY=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
-            return 0
+            COMPREPLY=( $(cd /var/log/packages; compgen -f -- "$cur") )
+            return
             ;;
         set) # --install-set
-            COMPREPLY=( $( compgen -W 'a ap d e f k kde kdei l n t tcl x \
-                xap y' -- "$cur" ) )
-            return 0
+            COMPREPLY=( $(compgen -W 'a ap d e f k kde kdei l n t tcl x
+                xap y' -- "$cur") )
+            return
             ;;
     esac
 } && complete -F _slapt_get slapt-get
diff --git a/completions/slapt-src b/completions/slapt-src
index 64b196e..acefafe 100644
--- a/completions/slapt-src
+++ b/completions/slapt-src
@@ -8,18 +8,18 @@ _slapt_src()
     case "$prev" in
         --config|-c)
             _filedir
-            return 0
+            return
             ;;
         --search|-s|--postprocess|-p)
             # argument required but no completions available
-            return 0
+            return
             ;;
     esac
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
+        COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help)' -- "$cur") )
         [[ $COMPREPLY == *= ]] && compopt -o nospace
-        [[ $COMPREPLY ]] && return 0
+        [[ $COMPREPLY ]] && return
     fi
 
     local i t
@@ -31,7 +31,7 @@ _slapt_src()
         fi
     done
     if [[ $t != all ]]; then
-        return 0
+        return
     fi
 
     local config="/etc/slapt-get/slapt-srcrc" # default config location
@@ -42,18 +42,18 @@ _slapt_src()
             break
         fi
     done
-    if [[ ! -r $config ]]; then
-        return 0
+    if [[ ! -r "$config" ]]; then
+        return
     fi
 
     if [[ "$cur" == *:* ]]; then
         local name=${cur%:*}
         local version=${cur##*:}
-        COMPREPLY=( $( slapt-src --config $config --search "^$name" 2> \
-            /dev/null | sed -ne "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}" ) )
+        COMPREPLY=( $(slapt-src --config "$config" --search "^$name" 2> \
+            /dev/null | sed -ne "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}") )
     else
-        COMPREPLY=( $( slapt-src --config $config --search "^$cur" 2>/dev/null \
-            | sed -ne "/^$cur/{s/ .*$//;p}" ) )
+        COMPREPLY=( $(slapt-src --config "$config" --search "^$cur" 2> \
+            /dev/null | sed -ne "/^$cur/{s/ .*$//;p}") )
     fi
 } && complete -F _slapt_src slapt-src
 
diff --git a/completions/upgradepkg b/completions/upgradepkg
index 59a27ca..b0ebb84 100644
--- a/completions/upgradepkg
+++ b/completions/upgradepkg
@@ -6,9 +6,9 @@ _upgradepkg()
     _init_completion || return
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '--dry-run --install-new --reinstall \
+        COMPREPLY=( $(compgen -W '--dry-run --install-new --reinstall
             --verbose' -- "$cur") )
-        return 0
+        return
     fi
 
     if [[ "$cur" == ?*%* ]]; then
@@ -16,11 +16,11 @@ _upgradepkg()
         cur="${cur#*%}"
         local nofiles IFS=$'\n'
         compopt -o filenames
-        COMPREPLY=( $( compgen -P "$prev%" -f -X "!*.@(t[bgxl]z)" -- "$cur" ) )
+        COMPREPLY=( $(compgen -P "$prev%" -f -X "!*.@(t[bgxl]z)" -- "$cur") )
         [[ $COMPREPLY ]] || nofiles=1
-        COMPREPLY+=( $( compgen -P "$prev%" -S '/' -d  -- "$cur" ) )
+        COMPREPLY+=( $(compgen -P "$prev%" -S '/' -d  -- "$cur") )
         [[ $nofiles ]] && compopt -o nospace
-        return 0
+        return
     fi
 
     _filedir "t[bglx]z"
diff --git a/completions/wine b/completions/wine
index 58e4cf4..bb89bf8 100644
--- a/completions/wine
+++ b/completions/wine
@@ -5,7 +5,7 @@ _wine()
     local cur prev words cword
     _init_completion || return
 
-    if [[ "$cword" -eq 1 ]]; then
+    if [[ $cword -eq 1 ]]; then
         if [[ "$cur" == -* ]]; then
             COMPREPLY=( $(compgen -W '--help --version' -- "$cur") )
             [[ $COMPREPLY ]] && return
diff --git a/completions/xgamma b/completions/xgamma
index 4c434cf..e17d551 100644
--- a/completions/xgamma
+++ b/completions/xgamma
@@ -9,7 +9,7 @@ _xgamma()
         -screen)
             local screens=$(xrandr --query 2>/dev/null | \
                 sed -n '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null)
-            COMPREPLY=( $(compgen -W "$screens" -- "$cur"))
+            COMPREPLY=( $(compgen -W "$screens" -- "$cur") )
             return
             ;;
         -gamma|-rgamma|-ggamma|-bgamma)
@@ -33,7 +33,8 @@ _xgamma()
                 local t screens=$(xrandr --query 2>/dev/null | sed -n \
                     -e '/^Screen /s|^Screen \{1,\}\(.*\):.*$|\1|p' 2>/dev/null)
                 t="${cur#:}"
-                COMPREPLY=( $(compgen -P "${t%.*}." -W "$screens" -- "${cur##*.}"))
+                COMPREPLY=( $(compgen -P "${t%.*}." -W "$screens" -- \
+                    "${cur##*.}") )
             elif [[ "$cur" != *:* ]]; then
                 # complete hostnames
                 _known_hosts_real -c "$cur"
@@ -48,7 +49,7 @@ _xgamma()
     esac
 
     if [[ "$cur" == -* ]]; then
-        COMPREPLY=( $( compgen -W '$( _parse_help "$1" -help )' -- "$cur" ) )
+        COMPREPLY=( $(compgen -W '$(_parse_help "$1" -help)' -- "$cur") )
         [[ $COMPREPLY == *= ]] && compopt -o nospace
         [[ $COMPREPLY ]] && return
     fi
diff --git a/completions/xhost b/completions/xhost
index 397ca9c..22839e4 100644
--- a/completions/xhost
+++ b/completions/xhost
@@ -10,8 +10,6 @@ _xhost ()
         -*) _known_hosts_real -p- "${cur:1}" ;;
         *)  _known_hosts_real "$cur" ;;
     esac
-
-    return 0
 } &&
 complete -F _xhost xhost
 
diff --git a/completions/xrandr b/completions/xrandr
index 3616429..126577e 100644
--- a/completions/xrandr
+++ b/completions/xrandr
@@ -7,52 +7,50 @@ _xrandr()
 
     local output modes
 
-    case $prev in
+    case "$prev" in
         --output|--left-of|--right-of|--above|--below|--same-as)
             local outputs=$(xrandr|awk '/connected/ {print $1}')
-            COMPREPLY=( $(compgen -W "$outputs" -- "$cur"))
-            return 0
+            COMPREPLY=( $(compgen -W "$outputs" -- "$cur") )
+            return
             ;;
         --mode)
             for(( i = 1; i < cword; i++ )); do
-                if [[ "${words[i]}" == "--output" ]]; then
+                if [[ "${words[i]}" == --output ]]; then
                     output=${words[i+1]}
                     break
                 fi
             done
             modes=$(xrandr|sed -e "1,/$output/ d" \
                 -e "/connected/,$ d"|awk '{print $1}')
-            COMPREPLY=( $( compgen -W "$modes" -- "$cur"))
-            return 0
+            COMPREPLY=( $(compgen -W "$modes" -- "$cur") )
+            return
             ;;
         -o|--orientation)
-            COMPREPLY=( $( compgen -W 'normal inverted left right 0 1 2 3' -- \
-                "$cur" ) )
-            return 0
+            COMPREPLY=( $(compgen -W 'normal inverted left right 0 1 2 3' -- \
+                "$cur") )
+            return
             ;;
         --reflect)
-            COMPREPLY=( $( compgen -W 'normal x y xy' -- \
-                "$cur" ) )
-            return 0
+            COMPREPLY=( $(compgen -W 'normal x y xy' -- "$cur") )
+            return
             ;;
         --rotate)
-            COMPREPLY=( $( compgen -W 'normal inverted left right' -- \
-                "$cur" ) )
-            return 0
+            COMPREPLY=( $(compgen -W 'normal inverted left right' -- "$cur") )
+            return
             ;;
     esac
 
     case $cur in
         *)
-            COMPREPLY=( $(compgen -W '-display -help --orientation --query \
-                --size --rate --version -x -y --screen --verbose --dryrun \
-                --q1 --q12 --nograb --prop --properties --fb --fbmm --dpi \
-                --output --auto --mode --preferred --pos --rate --refresh \
-                --reflect --rotate --left-of --right-of --above --below \
-                --same-as --set --scale --transform --off --crtc --panning \
-                --gamma --brightness --primary --noprimary --newmode --rmmode \
+            COMPREPLY=( $(compgen -W '-display -help --orientation --query
+                --size --rate --version -x -y --screen --verbose --dryrun
+                --q1 --q12 --nograb --prop --properties --fb --fbmm --dpi
+                --output --auto --mode --preferred --pos --rate --refresh
+                --reflect --rotate --left-of --right-of --above --below
+                --same-as --set --scale --transform --off --crtc --panning
+                --gamma --brightness --primary --noprimary --newmode --rmmode
                 --addmode --delmode' -- "$cur") )
-            return 0
+            return
             ;;
     esac
 } &&

-- 
bash-completion



More information about the Bash-completion-commits mailing list