Skip to content

Commit 395e463

Browse files
committed
perf(portinstall): return earlier for -lLo and non-existent file
1 parent cd8c870 commit 395e463

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

completions/portinstall

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ _comp_cmd_portinstall()
55
local cur prev words cword comp_args
66
_comp_initialize -- "$@" || return
77

8+
[[ $prev == -l || $prev == -L || $prev == -o ]] && return
9+
810
local portsdir indexfile
911
local -a COMPREPLY2
1012

@@ -15,8 +17,7 @@ _comp_cmd_portinstall()
1517
# Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x
1618
[[ ${OSTYPE%.*} == freebsd5 && -f $indexfile ]] ||
1719
indexfile=$portsdir/INDEX
18-
19-
[[ $prev == -l || $prev == -L || $prev == -o ]] && return
20+
[[ -f $indexfile && -r $indexfile ]] || return
2021

2122
COMPREPLY=($(command grep -E "^$cur" 2>/dev/null <"$indexfile" |
2223
cut -d'|' -f1))

0 commit comments

Comments
 (0)