Lines 716-740
Link Here
|
716 |
have ebuild && { |
716 |
have ebuild && { |
717 |
_ebuild() |
717 |
_ebuild() |
718 |
{ |
718 |
{ |
719 |
local cur opts |
719 |
local cur opts cmds i noopts seenf |
720 |
COMPREPLY=() |
720 |
COMPREPLY=() |
721 |
cur="${COMP_WORDS[COMP_CWORD]}" |
721 |
cur="${COMP_WORDS[COMP_CWORD]}" |
722 |
|
722 |
|
723 |
opts="help setup clean fetch digest manifest unpack compile test preinst \ |
723 |
cmds="help setup clean fetch digest manifest unpack compile test preinst \ |
724 |
install postinst qmerge merge unmerge prerm postrm config package rpm \ |
724 |
install postinst qmerge merge unmerge prerm postrm config package rpm \ |
725 |
configure prepare" |
725 |
configure prepare" |
726 |
|
726 |
|
727 |
if [[ $COMP_CWORD -eq 1 ]] ; then |
727 |
opts="--debug --force --ignore-default-opts --skip-manifest --help" |
728 |
COMPREPLY=($(compgen -f -X "!*.ebuild" -- ${cur}) \ |
|
|
729 |
$(compgen -d -- ${cur}) \ |
730 |
$(compgen -W '--debug --force --help --ignore-default-opts --skip-manifest' -- ${cur})) |
731 |
|
728 |
|
732 |
elif [[ $COMP_CWORD -eq 2 && "${COMP_WORDS[1]}" = "--debug --force --ignore-default-opts --skip-manifest" ]] ; then |
729 |
local i noopts seenf |
733 |
COMPREPLY=($(compgen -f -X "!*.ebuild" -- ${cur}) $(compgen -d -- ${cur})) |
|
|
734 |
|
730 |
|
735 |
elif [[ $COMP_CWORD -ge 2 ]] ; then |
731 |
for (( i=1 ; $i < ${COMP_CWORD} ; i++ )) ; do |
736 |
COMPREPLY=($(compgen -W "${opts}" -- ${cur})) |
732 |
[[ ${noopts} || ${COMP_WORDS[$i]/#-*} ]] && seenf=1 |
|
|
733 |
[[ ${COMP_WORDS[$i]} == "--" ]] && noopts=1 |
734 |
done |
735 |
|
736 |
if [[ ${seenf} ]] ; then |
737 |
COMPREPLY=($(compgen -W "${cmds}" -- ${cur})) |
738 |
else |
739 |
COMPREPLY=($(compgen -f -X "!*.ebuild" -- ${cur}) \ |
740 |
$(compgen -d -- ${cur})) |
737 |
fi |
741 |
fi |
|
|
742 |
|
743 |
[[ ${noopts} ]] || COMPREPLY+=($(compgen -W "${opts}" -- ${cur})) |
738 |
return 0 |
744 |
return 0 |
739 |
} |
745 |
} |
740 |
complete -o filenames -F _ebuild ebuild |
746 |
complete -o filenames -F _ebuild ebuild |