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

This commit is contained in:
Ville Skyttä 2011-04-24 19:35:42 +03:00
parent f8d8444667
commit 1b85a1bf58
7 changed files with 11 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 | \

View File

@ -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"

View File

@ -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