Skip to content

Commit 1b85a1b

Browse files
committed
Treat arguments starting with . or ~ as paths where that check is done.
1 parent f8d8444 commit 1b85a1b

File tree

7 files changed

+11
-10
lines changed

7 files changed

+11
-10
lines changed

completions/_yum

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ _yum()
4949

5050
if [ -n "$special" ]; then
5151
# TODO: install|update|upgrade should not match *src.rpm
52-
if [[ "$cur" == */* && "$special" == @(deplist|install|update|upgrade) ]]; then
52+
if [[ "$cur" == @(*/|[.~])* && \
53+
"$special" == @(deplist|install|update|upgrade) ]]; then
5354
_filedir rpm
5455
return 0
5556
fi

completions/info

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ _info()
99

1010
_expand || return 0
1111

12-
# default completion if parameter contains /
13-
if [[ "$cur" == */* ]]; then
12+
# default completion if parameter looks like a path
13+
if [[ "$cur" == @(*/|[.~])* ]]; then
1414
_filedir
1515
return 0
1616
fi

completions/man

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ _man()
1919

2020
_expand || return 0
2121

22-
# file based completion if parameter contains /
23-
if [[ "$cur" == */* ]]; then
22+
# file based completion if parameter looks like a path
23+
if [[ "$cur" == @(*/|[.~])* ]]; then
2424
_filedir $manext
2525
return 0
2626
fi

completions/module-init-tools

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ _insmod()
3131
fi
3232

3333
# do filename completion if we're giving a path to a module
34-
if [[ "$cur" == */* ]]; then
34+
if [[ "$cur" == @(*/|[.~])* ]]; then
3535
_filedir '@(?(k)o?(.gz))'
3636
return 0
3737
fi

completions/perl

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ _perldoc()
113113
COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" ))
114114
else
115115
# return available modules (unless it is clearly a file)
116-
if [[ "$cur" != */* ]]; then
116+
if [[ "$cur" != @(*/|[.~])* ]]; then
117117
_perlmodules $perl
118118
COMPREPLY+=( $( compgen -W \
119119
'$( MANPAGER=/bin/cat PAGER=/bin/cat man perl | \

completions/ssh

+2-2
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ _scp()
374374
COMPREPLY=( "${COMPREPLY[@]/%/ }" )
375375
return 0
376376
;;
377-
*/*)
378-
# pass through
377+
*/*|[.~]*)
378+
# not a known host, pass through
379379
;;
380380
*)
381381
_known_hosts_real -c -a -F "$configfile" "$cur"

completions/sshfs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ _sshfs()
1818
return 0
1919
fi
2020

21-
[[ "$cur" == */* ]] || _known_hosts_real -c -a "$cur"
21+
[[ "$cur" == @(*/|[.~])* ]] || _known_hosts_real -c -a "$cur"
2222

2323
declare -F _scp_local_files &>/dev/null && _scp_local_files -d
2424

0 commit comments

Comments
 (0)