Lines 17-29
Link Here
|
17 |
origdir="${PWD}" |
17 |
origdir="${PWD}" |
18 |
COMPREPLY=() |
18 |
COMPREPLY=() |
19 |
portagedir="$( (source /etc/make.conf; echo ${PORTDIR}) )" |
19 |
portagedir="$( (source /etc/make.conf; echo ${PORTDIR}) )" |
20 |
if [ ${portagedir} = "" ]; then |
20 |
if [ "${portagedir}" = "" ]; then |
21 |
portagedir=/usr/portage |
21 |
portagedir=/usr/portage |
22 |
fi |
22 |
fi |
23 |
cur="${COMP_WORDS[COMP_CWORD]}" |
23 |
cur="${COMP_WORDS[COMP_CWORD]}" |
24 |
|
24 |
|
25 |
cd "${portagedir}" |
25 |
cd "${portagedir}" |
26 |
grepcmd="grep -E ^${cur}.*" |
26 |
grepcmd="grep -e ^${cur}.*" |
27 |
sedcmd="sed -e /^[^-]*$/d" |
27 |
sedcmd="sed -e /^[^-]*$/d" |
28 |
case "$cur" in |
28 |
case "$cur" in |
29 |
-*) |
29 |
-*) |
Lines 33-44
Link Here
|
33 |
;; |
33 |
;; |
34 |
*) |
34 |
*) |
35 |
if [ "${cur}" ]; then |
35 |
if [ "${cur}" ]; then |
36 |
if [ $(echo "${cur}" | grep '/') ]; then |
36 |
if [ "$(echo "${cur}" | grep '/')" ]; then |
37 |
setbig=$(compgen -G "${cur}*" | ${sedcmd})"${systemactions}" |
37 |
setbig=$(compgen -G "${cur}*" | ${sedcmd})"${systemactions}" |
38 |
COMPREPLY=($(echo "${setbig}" | $grepcmd)) |
38 |
COMPREPLY=($(echo "${setbig}" | $grepcmd)) |
39 |
else |
39 |
else |
40 |
setsma=$(compgen -S '/' -G "${cur}*" | ${sedcmd})"${systemactions}" |
40 |
setsma=$(compgen -S '/' -G "${cur}*" | ${sedcmd})"${systemactions}" |
41 |
if [ $(echo "${setsma}" | ${grepcmd} | grep '/' | wc -l) = 1 ]; then |
41 |
if [ "$(echo "${setsma}" | ${grepcmd} | grep '/' | wc -l)" = 1 ]; then |
42 |
setbig=$(compgen -G "*/*" | ${sedcmd})"${systemactions}" |
42 |
setbig=$(compgen -G "*/*" | ${sedcmd})"${systemactions}" |
43 |
COMPREPLY=($(echo "${setbig}" | ${grepcmd})) |
43 |
COMPREPLY=($(echo "${setbig}" | ${grepcmd})) |
44 |
else |
44 |
else |