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

Ville Skyttä ville.skytta at iki.fi
Sun Jan 24 17:44:13 UTC 2010


The following commit has been merged in the master branch:
commit 359db46260b1b781f0999fa1516cc3a88976b050
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Jan 24 19:43:16 2010 +0200

    Don't bother looking for showmount if not doing NFS completion.

diff --git a/contrib/mount b/contrib/mount
index 59bbd26..f9fafb1 100644
--- a/contrib/mount
+++ b/contrib/mount
@@ -9,21 +9,23 @@ have mount &&
 
 _mount()
 {
-    local cur i sm host prev
+    local cur sm host prev
 
     COMPREPLY=()
     cur=`_get_cword ':'`
     prev=`_get_pword ':'`
     [[ "$cur" == \\ ]] && cur="/"
 
-    for i in $(type -P showmount) {,/usr}/{,s}bin/showmount; do
-        [ -x $i ] && sm=$i && break
-    done
+    if [[ "$cur" == *:* ]]; then
+        for sm in $(type -P showmount) {,/usr}/{,s}bin/showmount; do
+            [ -x $sm ] || continue
+            COMPREPLY=( $( compgen -W "$( $sm -e ${cur%%:*} | \
+                awk 'NR>1 {print $1}' )" -- "${cur#*:}" ) )
+            return 0
+        done
+    fi
 
-    if [[ -n "$sm" && "$cur" == *:* ]]; then
-        COMPREPLY=( $( compgen -W "$( $sm -e ${cur%%:*} | \
-            awk 'NR>1 {print $1}' )" -- "${cur#*:}" ) )
-    elif [[ "$cur" == //* ]]; then
+    if [[ "$cur" == //* ]]; then
         host=${cur#//}
         host=${host%%/*}
         if [ -n "$host" ]; then

-- 
bash-completion



More information about the Bash-completion-commits mailing list