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

Ville Skyttä ville.skytta at iki.fi
Sat Feb 5 10:14:48 UTC 2011


The following commit has been merged in the master branch:
commit 6aecdb5f4cf0fe8b44ee6a3a6442898141185711
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Feb 5 12:06:53 2011 +0200

    Avoid some unnecessary stat calls.

diff --git a/completions/java b/completions/java
index eacd85e..b8bbb79 100644
--- a/completions/java
+++ b/completions/java
@@ -60,7 +60,7 @@ _java_classes()
     cur=${cur//.//}
     # parse each classpath element for classes
     for i in ${classpath//:/ }; do
-        if [[ -r $i && "$i" == *.@(jar|zip) ]]; then
+        if [[ "$i" == *.@(jar|zip) && -r $i ]]; then
             if type zipinfo &>/dev/null; then
                 COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
                     "$i" "$cur*" 2>/dev/null | \
diff --git a/completions/mutt b/completions/mutt
index a753a65..e5e9d28 100644
--- a/completions/mutt
+++ b/completions/mutt
@@ -37,8 +37,11 @@ _muttrc()
     done
 
     if [ -z "$muttrc" ]; then
-        [ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc"
-        [ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc"
+        if [ -f ~/.${muttcmd}rc ]; then
+            muttrc="~/.${muttcmd}rc"
+        elif [ -f ~/.${muttcmd}/${muttcmd}rc ]; then
+            muttrc="~/.${muttcmd}/${muttcmd}rc"
+        fi
     fi
     printf "%s" "$muttrc"
 } # _muttrc()
diff --git a/completions/service b/completions/service
index ffd2436..1a36f59 100644
--- a/completions/service
+++ b/completions/service
@@ -19,11 +19,11 @@ _service()
     # don't complete past 2nd token
     [ $COMP_CWORD -gt 2 ] && return 0
 
-    [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
-
     if [[ $COMP_CWORD -eq 1 && $prev == "service" ]]; then
         _services
     else
+        [ -d /etc/rc.d/init.d ] && \
+            sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
         COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
             -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
             $sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )

-- 
bash-completion



More information about the Bash-completion-commits mailing list