Skip to content

Commit

Permalink
perf(portinstall): return earlier for -lLo and non-existent file
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Oct 3, 2023
1 parent cd8c870 commit 395e463
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions completions/portinstall
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ _comp_cmd_portinstall()
local cur prev words cword comp_args
_comp_initialize -- "$@" || return

[[ $prev == -l || $prev == -L || $prev == -o ]] && return

local portsdir indexfile
local -a COMPREPLY2

Expand All @@ -15,8 +17,7 @@ _comp_cmd_portinstall()
# Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x
[[ ${OSTYPE%.*} == freebsd5 && -f $indexfile ]] ||
indexfile=$portsdir/INDEX

[[ $prev == -l || $prev == -L || $prev == -o ]] && return
[[ -f $indexfile && -r $indexfile ]] || return

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

0 comments on commit 395e463

Please sign in to comment.