[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-135-g3a39ac6

Ville Skyttä ville.skytta at iki.fi
Wed Apr 27 15:42:01 UTC 2011


The following commit has been merged in the master branch:
commit 48ffb0ac6d5ef280bd7b0ef8391a69e6c795f53e
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Wed Apr 27 15:46:27 2011 +0300

    No need to test for COMPREPLY count when toggling nospace.
    
    It only takes effect if there's only one completion anyway.

diff --git a/completions/java b/completions/java
index aba9513..f167be8 100644
--- a/completions/java
+++ b/completions/java
@@ -78,8 +78,7 @@ _java_classes()
                 $( compgen -f -X '!*.class' -- "$i/$cur" | \
                     sed -e '/\$/d' -e "s|^$i/||" )
             )
-            [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == *.class ]] && \
-                compopt +o nospace &>/dev/null
+            [[ $COMPREPLY == *.class ]] && compopt +o nospace &>/dev/null
 
             # FIXME: if we have foo.class and foo/, the completion
             # returns "foo/"... how to give precedence to files
@@ -232,8 +231,7 @@ _java()
         fi
     fi
 
-    [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == -*[:=] ]] && \
-        compopt -o nospace
+    [[ $COMPREPLY == -*[:=] ]] && compopt -o nospace
 
     __ltrim_colon_completions "$cur"
 } &&
@@ -380,8 +378,7 @@ _pack200()
                 --method-attribute= --code-attribute= --config-file= \
                 --verbose --quiet --log-file= --help --version -J \
                 --repack' -- "$cur" ) )
-            [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == *= ]] && \
-                compopt -o nospace
+            [[ $COMPREPLY == *= ]] && compopt -o nospace
         else
             _filedir 'pack?(.gz)'
         fi
@@ -425,8 +422,7 @@ _unpack200()
         if [[ "$cur" == -* ]] ; then
             COMPREPLY=( $( compgen -W '--deflate-hint= --remove-pack-file \
                 --verbose --quiet --log-file= --help --version' -- "$cur" ) )
-            [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == *= ]] && \
-                compopt -o nospace
+            [[ $COMPREPLY == *= ]] && compopt -o nospace
         else
             _filedir 'pack?(.gz)'
         fi
diff --git a/completions/rsync b/completions/rsync
index 01f66a4..e3734f2 100644
--- a/completions/rsync
+++ b/completions/rsync
@@ -68,8 +68,7 @@ _rsync()
                 --write-batch= --only-write-batch= --read-batch= --protocol= \
                 --iconv= --ipv4 --ipv6 --version --help --daemon --config= \
                 --no-detach' -- "$cur" ) )
-            [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] && \
-                compopt +o nospace
+            [[ $COMPREPLY == *= ]] || compopt +o nospace
             ;;
         *:*)
             if declare -F _scp_remote_files &>/dev/null; then
diff --git a/completions/smartctl b/completions/smartctl
index 9d17c56..ba68696 100644
--- a/completions/smartctl
+++ b/completions/smartctl
@@ -78,8 +78,7 @@ _smartctl_test()
     COMPREPLY=( $( compgen -W 'offline short long conveyance select,
         select,redo select,next afterselect,on afterselect,off pending,
         scttempint, vendor,' -- "$cur" ) )
-    [[ ${#COMPREPLY[@]} -eq 1 && "${COMPREPLY[@]}" == *, ]] && \
-        compopt -o nospace
+    [[ $COMPREPLY == *, ]] && compopt -o nospace
 }
 _smartctl_drivedb()
 {
diff --git a/completions/sysbench b/completions/sysbench
index 12fed76..85e8896 100644
--- a/completions/sysbench
+++ b/completions/sysbench
@@ -134,8 +134,7 @@ _sysbench()
 
     if [[ "$cur" == -* || ! $test ]]; then
         COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
-        [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] || \
-            compopt -o nospace
+        [[ $COMPREPLY == *= ]] && compopt -o nospace
     else
         COMPREPLY=( $( compgen -W "prepare run cleanup help version" \
             -- "$cur" ) )
diff --git a/completions/wodim b/completions/wodim
index 5431b83..bc2912a 100644
--- a/completions/wodim
+++ b/completions/wodim
@@ -43,8 +43,7 @@ _cdrecord()
                         gigarec= audiomaster forcespeed noforcespeed speedread
                         nospeedread singlesession nosinglesession hidecdr
                         nohidecdr tattooinfo tattoofile=' -- "$cur" ) )
-                    [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] || \
-                        compopt -o nospace
+                    [[ $COMPREPLY == *= ]] && compopt -o nospace
                 fi
                 ;;
             driver)
@@ -91,7 +90,7 @@ _cdrecord()
     if [ $track_mode -eq 0 ]; then
         COMPREPLY+=( $( compgen -W '${generic_options[@]}' -- "$cur" ) )
     fi
-    [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] || compopt -o nospace
+    [[ $COMPREPLY == *= ]] && compopt -o nospace
 } &&
 complete -F _cdrecord cdrecord wodim
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list