[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-109-gf8d8444

Ville Skyttä ville.skytta at iki.fi
Sun Apr 24 16:03:59 UTC 2011


The following commit has been merged in the master branch:
commit f8d8444667e2a341c85b383396179c69db66d46b
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Apr 24 18:55:04 2011 +0300

    Use "declare -F" instead of "type" to check for function existence.
    
    Avoids some stat() calls when it doesn't exist.

diff --git a/completions/cvsps b/completions/cvsps
index f27f2f3..a3e2388 100644
--- a/completions/cvsps
+++ b/completions/cvsps
@@ -44,7 +44,7 @@ _cvsps()
             return 0
             ;;
         --root)
-            type _cvs_roots &>/dev/null && _cvs_roots
+            declare -F _cvs_roots &>/dev/null && _cvs_roots
             return 0
             ;;
     esac
@@ -55,7 +55,7 @@ _cvsps()
             --cvs-direct --no-cvs-direct --debuglvl -Z --root -q -A' \
             -- "$cur" ) )
     else
-        type _cvs_roots &>/dev/null && _cvs_roots
+        declare -F _cvs_roots &>/dev/null && _cvs_roots
     fi
 } &&
 complete -F _cvsps cvsps
diff --git a/completions/portupgrade b/completions/portupgrade
index 834b02b..0e8a20b 100644
--- a/completions/portupgrade
+++ b/completions/portupgrade
@@ -48,7 +48,7 @@ _portinstall()
 complete -F _portinstall -o dirnames portinstall
 
 # _pkg_delete is in pkg_install
-type _pkg_delete &>/dev/null && have pkg_deinstall && \
+declare -F _pkg_delete &>/dev/null && have pkg_deinstall && \
 complete -F _pkg_delete -o dirnames pkg_deinstall
 
 # Local variables:
diff --git a/completions/rsync b/completions/rsync
index 1753f10..da3334e 100644
--- a/completions/rsync
+++ b/completions/rsync
@@ -72,7 +72,7 @@ _rsync()
                 compopt +o nospace
             ;;
         *:*)
-            if type _scp_remote_files &>/dev/null; then
+            if declare -F _scp_remote_files &>/dev/null; then
                 # find which remote shell is used
                 local i shell=ssh
                 for (( i=1; i < cword; i++ )); do
@@ -86,7 +86,8 @@ _rsync()
             ;;
         *)
             _known_hosts_real -c -a "$cur"
-            type _scp_local_files &>/dev/null && _scp_local_files || _filedir
+            declare -F _scp_local_files &>/dev/null && \
+                _scp_local_files || _filedir
             ;;
     esac
 
diff --git a/completions/sshfs b/completions/sshfs
index ce34d95..ec07db2 100644
--- a/completions/sshfs
+++ b/completions/sshfs
@@ -11,7 +11,7 @@ _sshfs()
 
     _expand || return 0
 
-    if [[ "$cur" == *:* ]] && type _scp_remote_files &>/dev/null ; then
+    if [[ "$cur" == *:* ]] && declare -F _scp_remote_files &>/dev/null ; then
         _scp_remote_files -d
         # unlike scp and rsync, sshfs works with 1 backslash instead of 3
         COMPREPLY=( "${COMPREPLY[@]//\\\\\\/\\}" )
@@ -20,7 +20,7 @@ _sshfs()
 
     [[ "$cur" == */* ]] || _known_hosts_real -c -a "$cur"
 
-    type _scp_local_files &>/dev/null && _scp_local_files -d
+    declare -F _scp_local_files &>/dev/null && _scp_local_files -d
 
     return 0
 } &&

-- 
bash-completion



More information about the Bash-completion-commits mailing list