[Bash-completion-commits] [SCM] bash-completion branch, master, updated. ff7c17e599399b763b6271768d9d23497c72bd74

Ville Skyttä ville.skytta at iki.fi
Thu Jul 1 17:22:29 UTC 2010


The following commit has been merged in the master branch:
commit ff7c17e599399b763b6271768d9d23497c72bd74
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Thu Jul 1 20:21:35 2010 +0300

    Trivial cleanups.

diff --git a/bash_completion b/bash_completion
index 732cb9a..ef00f05 100644
--- a/bash_completion
+++ b/bash_completion
@@ -310,7 +310,7 @@ __reassemble_comp_words_by_ref() {
             ref="$2[$j]"
             eval $2[$j]=\${!ref}\${COMP_WORDS[i]}
             # Indicate new cword
-            [ $i = $COMP_CWORD ] && [[ ${COMP_WORDS[i]} ]] && eval $3=$j
+            [[ $i == $COMP_CWORD && ${COMP_WORDS[i]} ]] && eval $3=$j
         done
     else
         # No, list of word completions separators hasn't changed;
@@ -464,7 +464,7 @@ _get_cword()
     # return previous word offset by $2
     if [[ ${2//[^0-9]/} ]]; then
         printf "%s" "${words[cword-$2]}"
-    elif [[ "${#words[cword]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
+    elif [[ "${#words[cword]}" -eq 0 || "$COMP_POINT" == "${#COMP_LINE}" ]]; then
         printf "%s" "${words[cword]}"
     else
         local i
diff --git a/contrib/cvs b/contrib/cvs
index 04837cd..be3b1be 100644
--- a/contrib/cvs
+++ b/contrib/cvs
@@ -238,7 +238,7 @@ _cvs()
 
             set_prefix
 
-            if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
+            if [[ "$cur" != -* && -r ${prefix:-}CVS/Entries ]]; then
                 # if $COMP_CVS_REMOTE is not null, 'cvs commit' will
                 # complete on remotely checked-out files (requires
                 # passwordless access to the remote repository
diff --git a/contrib/mutt b/contrib/mutt
index fc12e69..f86e675 100644
--- a/contrib/mutt
+++ b/contrib/mutt
@@ -58,7 +58,7 @@ _muttconffiles()
     while [[ "$1" ]]; do
         newconffiles=( $(sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' $(eval echo $1) ) )
         for file in "${newconffiles[@]}"; do
-            [[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] &&
+            [[ ! "$file" || "${sofar/ ${file} / }" != "$sofar" ]] &&
                 continue
             sofar="$sofar $file"
             sofar=" $(eval _muttconffiles \"$sofar\" $file) "
diff --git a/contrib/service b/contrib/service
index 6efd7c1..ffd2436 100644
--- a/contrib/service
+++ b/contrib/service
@@ -21,7 +21,7 @@ _service()
 
     [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
 
-    if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
+    if [[ $COMP_CWORD -eq 1 && $prev == "service" ]]; then
         _services
     else
         COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \

-- 
bash-completion



More information about the Bash-completion-commits mailing list