[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-114-ga0afe09

Ville Skyttä ville.skytta at iki.fi
Sun Apr 24 17:23:38 UTC 2011


The following commit has been merged in the master branch:
commit 1b85a1bf582fe000c812b2dc025971b1fa1f78c7
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Apr 24 19:35:42 2011 +0300

    Treat arguments starting with . or ~ as paths where that check is done.

diff --git a/completions/_yum b/completions/_yum
index 64989f2..ca56127 100644
--- a/completions/_yum
+++ b/completions/_yum
@@ -49,7 +49,8 @@ _yum()
 
     if [ -n "$special" ]; then
         # TODO: install|update|upgrade should not match *src.rpm
-        if [[ "$cur" == */* && "$special" == @(deplist|install|update|upgrade) ]]; then
+        if [[ "$cur" == @(*/|[.~])* && \
+            "$special" == @(deplist|install|update|upgrade) ]]; then
             _filedir rpm
             return 0
         fi
diff --git a/completions/info b/completions/info
index 93d1f4a..e73b895 100644
--- a/completions/info
+++ b/completions/info
@@ -9,8 +9,8 @@ _info()
 
     _expand || return 0
 
-    # default completion if parameter contains /
-    if [[ "$cur" == */* ]]; then
+    # default completion if parameter looks like a path
+    if [[ "$cur" == @(*/|[.~])* ]]; then
         _filedir
         return 0
     fi
diff --git a/completions/man b/completions/man
index c29cf09..0460105 100644
--- a/completions/man
+++ b/completions/man
@@ -19,8 +19,8 @@ _man()
 
     _expand || return 0
 
-    # file based completion if parameter contains /
-    if [[ "$cur" == */* ]]; then
+    # file based completion if parameter looks like a path
+    if [[ "$cur" == @(*/|[.~])* ]]; then
         _filedir $manext
         return 0
     fi
diff --git a/completions/module-init-tools b/completions/module-init-tools
index fcef11c..9d24d16 100644
--- a/completions/module-init-tools
+++ b/completions/module-init-tools
@@ -31,7 +31,7 @@ _insmod()
     fi
 
     # do filename completion if we're giving a path to a module
-    if [[ "$cur" == */* ]]; then
+    if [[ "$cur" == @(*/|[.~])* ]]; then
         _filedir '@(?(k)o?(.gz))'
         return 0
     fi
diff --git a/completions/perl b/completions/perl
index b8a87f0..3c3423f 100644
--- a/completions/perl
+++ b/completions/perl
@@ -113,7 +113,7 @@ _perldoc()
         COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" ))
     else
         # return available modules (unless it is clearly a file)
-        if [[ "$cur" != */* ]]; then
+        if [[ "$cur" != @(*/|[.~])* ]]; then
             _perlmodules $perl
             COMPREPLY+=( $( compgen -W \
                 '$( MANPAGER=/bin/cat PAGER=/bin/cat man perl |  \
diff --git a/completions/ssh b/completions/ssh
index 4ded71d..f75056b 100644
--- a/completions/ssh
+++ b/completions/ssh
@@ -374,8 +374,8 @@ _scp()
                 COMPREPLY=( "${COMPREPLY[@]/%/ }" )
                 return 0
                 ;;
-            */*)
-                # pass through
+            */*|[.~]*)
+                # not a known host, pass through
                 ;;
             *)
                 _known_hosts_real -c -a -F "$configfile" "$cur"
diff --git a/completions/sshfs b/completions/sshfs
index ec07db2..b29d1d5 100644
--- a/completions/sshfs
+++ b/completions/sshfs
@@ -18,7 +18,7 @@ _sshfs()
         return 0
     fi
 
-    [[ "$cur" == */* ]] || _known_hosts_real -c -a "$cur"
+    [[ "$cur" == @(*/|[.~])* ]] || _known_hosts_real -c -a "$cur"
 
     declare -F _scp_local_files &>/dev/null && _scp_local_files -d
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list