File tree 1 file changed +7
-11
lines changed 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -7,24 +7,20 @@ _comp_cmd_portinstall()
7
7
8
8
[[ $prev == -l || $prev == -L || $prev == -o ]] && return
9
9
10
- local portsdir indexfile
11
- local -a COMPREPLY2
12
-
13
- portsdir=${PORTSDIR:-/ usr/ ports} /
10
+ local -x portsdir=${PORTSDIR:-/ usr/ ports} /
14
11
15
12
# First try INDEX-5
16
- indexfile=$portsdir /INDEX-5
13
+ local indexfile=$portsdir /INDEX-5
17
14
# Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x
18
15
[[ ${OSTYPE% .* } == freebsd5 && -f $indexfile ]] ||
19
16
indexfile=$portsdir /INDEX
20
17
[[ -f $indexfile && -r $indexfile ]] || return
21
18
22
- COMPREPLY=($( command grep -E " ^$cur " 2> /dev/null < " $indexfile " |
23
- cut -d' |' -f1) )
24
- COMPREPLY2=($( command grep -E " ^[^\|]+\|$portsdir$cur " 2> /dev/null \
25
- < " $indexfile " | cut -d' |' -f2) )
26
- COMPREPLY2=(${COMPREPLY2[@]# $portsdir } )
27
- COMPREPLY+=(" ${COMPREPLY2[@]} " )
19
+ _comp_compgen_split -l -- " $( awk -F ' |' '
20
+ BEGIN { portsdir = ENVIRON["portsdir"]; len = length(portsdir) }
21
+ { print $1 }
22
+ substr($2, 1, len) == portsdir { print substr($2, len + 1) }
23
+ ' " $indexfile " ) "
28
24
29
25
} &&
30
26
complete -F _comp_cmd_portinstall -o dirnames portinstall
You can’t perform that action at this time.
0 commit comments