Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 109697 | Differences between
and this patch

Collapse All | Expand All

(-)genlop.bash-completion (-11 / +13 lines)
Lines 12-44 Link Here
12
#
12
#
13
_genlop()
13
_genlop()
14
{
14
{
15
        local cur grepcmd sedcmd systemactions setsma setbig portagedir origdir
15
        local cur grepcmd sedcmd systemactions setsma setbig portagedir origdir args
16
                                                                                                                                                
16
                                                                                                                                                
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
		-*)
30
			COMPREPLY=( $( compgen -W '--current --file --help \
30
			args='-c -e -f -h -i -g -l -n -p -r -s -S -t -u -v'
31
			--info --gmt --list --nocolor --pretend --rsync \
31
			args="${args} --current --date --file --gmt --help \
32
			--search --time --unmerge --version' -- $cur ) )
32
                        	--info --list --nocolor --pretend --rsync \
33
				--search --time --unmerge --version"
34
			COMPREPLY=( $( compgen -W "${args}" -- ${cur} ) )
33
			;;
35
			;;
34
		*)
36
		*)
35
		        if [ "${cur}" ]; then
37
		        if [[ "${cur}" ]]; then
36
                		if [ $(echo "${cur}" | grep '/') ]; then
38
                		if [[ $(echo "${cur}" | grep '/') ]]; then
37
		                        setbig=$(compgen -G "${cur}*" | ${sedcmd})"${systemactions}"
39
		                        setbig=$(compgen -G "${cur}*" | ${sedcmd})"${systemactions}"
38
                		        COMPREPLY=($(echo "${setbig}" | $grepcmd))
40
                		        COMPREPLY=($(echo "${setbig}" | ${grepcmd}))
39
		                else
41
		                else
40
                		        setsma=$(compgen -S '/' -G "${cur}*" | ${sedcmd})"${systemactions}"
42
                		        setsma=$(compgen -S '/' -G "${cur}*" | ${sedcmd})"${systemactions}"
41
		                        if [ $(echo "${setsma}" | ${grepcmd} | grep '/' | wc -l) = 1 ]; then
43
		                        if [[ $(echo "${setsma}" | ${grepcmd} | grep '/' | wc -l) == 1 ]]; then
42
                		                setbig=$(compgen -G "*/*" | ${sedcmd})"${systemactions}"
44
                		                setbig=$(compgen -G "*/*" | ${sedcmd})"${systemactions}"
43
		                                COMPREPLY=($(echo "${setbig}" | ${grepcmd}))
45
		                                COMPREPLY=($(echo "${setbig}" | ${grepcmd}))
44
                		        else
46
                		        else

Return to bug 109697