summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2011-04-24 19:35:42 +0300
committerVille Skyttä <ville.skytta@iki.fi>2011-04-24 19:35:42 +0300
commit1b85a1bf582fe000c812b2dc025971b1fa1f78c7 (patch)
treee65fb78ccad34b4900a81a4774735b900e222fd0
parentf8d8444667e2a341c85b383396179c69db66d46b (diff)
downloadbash-completion-1b85a1bf582fe000c812b2dc025971b1fa1f78c7.tar.gz
Treat arguments starting with . or ~ as paths where that check is done.
-rw-r--r--completions/_yum3
-rw-r--r--completions/info4
-rw-r--r--completions/man4
-rw-r--r--completions/module-init-tools2
-rw-r--r--completions/perl2
-rw-r--r--completions/ssh4
-rw-r--r--completions/sshfs2
7 files changed, 11 insertions, 10 deletions
diff --git a/completions/_yum b/completions/_yum
index 64989f24..ca561273 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 93d1f4a3..e73b895e 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 c29cf093..04601058 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 fcef11c0..9d24d16f 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 b8a87f04..3c3423ff 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 4ded71df..f75056b7 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 ec07db2f..b29d1d58 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