Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 156083 Details for
Bug 218341
eix based emerge bash-completion alternative?
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
patched routine
new_emerge.sh (text/plain), 13.08 KB, created by
Imre Péntek
on 2008-06-09 14:17:02 UTC
(
hide
)
Description:
patched routine
Filename:
MIME Type:
Creator:
Imre Péntek
Created:
2008-06-09 14:17:02 UTC
Size:
13.08 KB
patch
obsolete
>_emerge () >{ > local c cur prev curword numwords opts cond prepend; > local words stopre stophere i x; > local action actionpos actionre sysactions eactions pkgpos; > local version_mode searchdesc_mode help_mode resume_mode; > local portdir=$(_portdir -o); > COMPREPLY=(); > cur="${COMP_WORDS[COMP_CWORD]}"; > prev="${COMP_WORDS[COMP_CWORD-1]}"; > numwords=${#COMP_WORDS[*]}; > curword=${COMP_CWORD}; > actionre='@(-?([A-Za-z]*)[CPcis]*|@(metadata|s@(y@(nc|stem)|earch)|regen|@(unmerg|prune)e|world|@(@(dep)@(clean)|@(in@(fo|ject)))))'; > stopre=' @(?(--)depclean|?(--)info|?(--)metadata|regen|sy@(nc|stem)|world|--@(resume|s@(kipfirst|ync)))'; > opts=''; > if [[ ${prev} == '>' || ${prev} == '<' ]]; then > COMPREPLY=($(compgen -f -- ${cur})); > return 0; > fi; > for x in ${COMP_LINE}; > do > if [[ ${x} == ${actionre} ]]; then > action=${x}; > break; > fi; > done; > if [[ -n "${action}" ]]; then > for ((i = 0; i < ${numwords}; i++ )) > do > if [[ ${COMP_WORDS[${i}]} == "${action}" ]]; then > actionpos=${i}; > pkgpos=$((actionpos + 1)); > break; > fi; > done; > if [[ ${action} == -* && ${action} != --* ]]; then > case "${action}" in > -*C*) > action='unmerge' > ;; > -*P*) > action='prune' > ;; > -*c*) > action='clean' > ;; > -*i*) > action='inject' > ;; > -*s*) > action='search' > ;; > esac; > fi; > else > for ((i = 1; i < ${numwords}; i++ )) > do > if [[ ! "${COMP_WORDS[$i]}" == -* ]]; then > pkgpos=${i}; > break; > fi; > done; > [[ -n "${pkgpos}" ]] || pkgpos=${numwords}; > fi; > [[ ${COMP_LINE} == *" "-@(V|-version)* ]] && version_mode=1; > [[ ${COMP_LINE} == *" "-@(S|-searchdesc)* ]] && searchdesc_mode=1; > [[ ${COMP_LINE} == *" "-@(h|-help)* ]] && help_mode=1; > if [[ "${action}" == 'search' ]] || [[ -n "${searchdesc_mode}" ]] || [[ -n "${version_mode}" ]] || [[ "${action}" == 'metadata' ]]; then > unset COMPREPLY; > return 0; > else > if [[ -n "${help_mode}" ]]; then > unset COMPREPLY; > [[ ${curword} -eq 2 ]] && COMPREPLY=($(compgen -W 'config sync system' -- ${cur})); > return 0; > fi; > fi; > if [[ "${cur}" == -* ]]; then > [[ ${COMP_LINE} == *--@(resume|skipfirst)* ]] && resume_mode=1; > if [[ -n "${resume_mode}" ]]; then > if [[ "${cur}" == --* ]]; then > opts="--ask --pretend --resume --skipfirst"; > else > if [[ "${cur}" == -* ]]; then > [[ ${COMP_LINE} == *--@(ask|pretend)* ]] && ask_premode=1; > [[ -n "${ask_premode}" ]] && opts="-a -p"; > fi; > fi; > else > if [[ "${cur}" == --* ]]; then > opts="--ask --autoclean --buildpkg --buildpkgonly --changelog --clean --columns --debug --deep --emptytree --fetch-all-uri --fetchonly --getbinpkg --getbinpkgonly --newuse --noconfmem --nodeps --noreplace --nospinner > --oneshot --onlydeps --pretend --quiet --sync --tree --update --upgradeonly --usepkg --usepkgonly --verbose --depclean --info --search"; > if [[ ${curword} -eq 1 ]] && [[ ${numwords} -eq 2 ]]; then > opts="${opts} --help --resume --searchdesc --version"; > fi; > else > if [[ "${cur}" == -* ]]; then > opts="-B -D -G -K -O -U -a -b -d -e -f -g -k -l -n -o -p -q -t -u -v"; > if [[ ${curword} -eq 1 ]] && [[ ${numwords} -eq 2 ]]; then > opts="${opts} -h -S -V"; > fi; > if [[ -z "${action}" ]] && [[ ${curword} -eq $((pkgpos - 1)) ]]; then > opts="${opts} -C -P -c -i -s"; > fi; > fi; > fi; > fi; > COMPREPLY=($(compgen -W "${opts}" -- ${cur})); > COMPREPLY=($(echo "${COMP_WORDS[@]}" | (while read -d ' ' i; do > [[ "${i}" == "" ]] && continue > # flatten array with spaces on either side, > # otherwise we cannot grep on word boundaries of > # first and last word > COMPREPLY=" ${COMPREPLY[@]} " > # remove word from list of completions > COMPREPLY=(${COMPREPLY/ ${i%% *} / }) > done > echo ${COMPREPLY[@]}))); > return 0; > fi; > if [[ ${COMP_LINE} == *${stopre}* ]]; then > unset COMPREPLY; > return 0; > fi; > if [[ "${action}" == 'unmerge' ]]; then > if [[ -n "${cur}" ]]; then > if [[ "${cur}" == */* ]]; then > words=$(builtin cd /var/db/pkg; compgen -G "${cur}*"); > else > words=$(builtin cd /var/db/pkg; compgen -S '/' -G "${cur}*"); > local n=0; > for i in ${words}; > do > [[ ${i} == ${cur}* ]] && n=$((n+1)); > done; > if [[ ${n} -eq 1 ]]; then > words="$(builtin cd /var/db/pkg ; compgen -G "*-*/*")"; > fi; > fi; > COMPREPLY=($(for i in ${words} ; do [[ ${i} == ${cur}* ]] && echo ${i} ; done)); > else > COMPREPLY=($(builtin cd /var/db/pkg ; compgen -S '/' -G "*-*")); > fi; > [[ -z "${COMPREPLY}" ]] && _pkgname_only ${cur} /var/db/pkg; > return 0; > fi; > cond="${cur%%[A-Za-z0-9]*}"; > cur="${cur:${#cond}}"; > if [[ ${cond:0:1} == "'" || ${cond:0:1} == '"' ]]; then > prepend="-P ${cond:1}"; > c="${cond:1}"; > else > c="${cond}"; > fi; > if [[ -n "${cond}" ]]; then > if [[ -n "${cur}" ]]; then > if [[ ${cur} == */* ]]; then > if [[ ${cur} == *-[0-9]* ]]; then > words="$( for pd in ${portdir} ; do builtin cd ${pd} ; local cat="${cur%/*}" ; local pkg="$(echo ${cur%-[0-9]*})" ; pkg="${pkg##*/}" ; for x in ${cat}/${pkg}/*.ebuild ; do [[ -f ${x} ]] || continue ; x="${x/${pkg}\/}" ; echo "${x%*.ebuild}" ; done ; done)"; > else > words="$( for pd in ${portdir} ; do builtin cd ${pd}; compgen -X "*metadata.xml" -G "${cur}*" -- ${cur} ; done)"; > fi; > local w; > for x in $words; > do > w="${x}\n${w}"; > done; > words=$(echo -ne ${w} | sort | uniq); > COMPREPLY=(${words}); > if [[ ${#COMPREPLY[@]} -le 1 ]]; then > COMPREPLY=($( for pd in ${portdir} ; do if [[ -d ${pd}/metadata/cache ]] ; then > builtin cd ${pd}/metadata/cache; compgen ${prepend} -G "${cur}*" -- "${cur}" ; else builtin cd ${pd} ; local cat="${cur%/*}" ; local pkg="$(echo ${cur%-[0-9]*}*)" ; pkg="${pkg##*/}" ; for x in ${cat}/${pkg}/*.ebuild ; do [[ -f "${x}" ]] || continue ; x="${x/${pkg}\/}" ; if [[ ${cond:0:1} == "'" ]] || [[ ${cond:0:1} == '"' ]] ; then > echo "${c}${x%*.ebuild}" ; else > echo "${x%*.ebuild}" ; fi ; done ; fi ; done)); > else > COMPREPLY=($(compgen ${prepend} -W "${words}" -- $cur)); > fi; > else > words="$( for pd in ${portdir} ; do builtin cd ${pd} ; compgen ${prepend} -S '/' -G "${cur}*" -- "${cur}" ; done)"; > local w; > for x in words; > do > w="${x}\n${w}"; > done; > COMPREPLY=($(echo -e ${w} | uniq)); > [[ ${#COMPREPLY[@]} = 1 ]] && COMPREPLY=($( for pd in ${portdir} ; do builtin cd ${pd} ; compgen ${prepend} -G "${cur}*/*" -- "${cur}" ; done)); > fi; > else > words="$( for pd in ${portdir} ; do builtin cd ${pd}; compgen -G "*-*"; done)"; > COMPREPLY=($(compgen -W "${words}" -- "${cur}")); > fi; > if [[ -z "${COMPREPLY}" ]]; then > words="$( for pd in ${portdir} ; do builtin cd ${pd}; for i in *-*/${cur}*; do [[ -d $i ]] && echo ${i##*/}; done ; done)"; > COMPREPLY=($(compgen ${prepend} -W "${words}" -- ${cur})); > if [[ ${#COMPREPLY[@]} -le 1 ]]; then > words="$( for pd in ${portdir} ; do if [[ -d ${pd}/metadata/cache ]] ; then builtin cd ${pd}/metadata/cache; for i in */${cur}*; do [[ -f $i ]] && echo ${i##*/}; done ; fi ; done)"; > COMPREPLY=($(compgen ${prepend} -W "${words}" -- "${cur}")); > fi; > fi; > return 0; > fi; > if [[ ${COMP_CWORD} -eq 1 ]]; then > if [[ $numwords -le 2 ]]; then > sysactions=' >'"system"' >'"world"' >'"sync"' >'"metadata"; > else > sysactions=' >'"system"' >'"world"' >'"sync"; > fi; > else > if [[ ! " ${COMP_LINE} " == *" "*[/]*" "* ]]; then > sysactions=' >'"system"' >'"world"; > else > sysactions=''; > fi; > fi; > if [[ -z "${action}" ]] && [[ ${curword} -le ${pkgpos} ]]; then > eactions=' >'"clean"' >'"depclean"' >'"inject"' >'"prune"' >'"regen"' >'"search"' >'"unmerge"; > fi; > if [[ -n "${cur}" ]]; then > if [[ ${cur} == virtual/* ]]; then > words=$( for pd in ${portdir} ; do if [[ -d ${pd}/profiles ]] ; then > find ${pd}/profiles -name virtuals -exec sed -n -e 's|^\(virtual/[[:alnum:]]\+\).*$|\1|p' {} \; | sort -u > fi ; done); > else > if [[ ${cur} == */* ]]; then > words=$( eix "${cur}"|grep '^\*'|cut -c 3- )"${sysactions}""${eactions}"; > else > local ww=$( for pd in ${portdir} ; do builtin cd ${pd} ; compgen -S '/' -G "${cur}*"; done)"${sysactions}""${eactions}"; > ww="${ww} $( for pd in ${portdir} ; do if [[ -d ${pd}/profiles ]] ; then > find ${pd}/profiles -name virtuals -exec sed -n -e 's|^\(virtual/[[:alnum:]]\+\).*$|\1|p' {} \; | sort -u > fi ; done)"; > local w; > for x in ${ww}; > do > w="${x}\n${w}"; > done; > words=$(echo -e ${w} | sort -u); > local n=0; > for i in ${words}; > do > [[ ${i} == ${cur}* ]] && n=$((n+1)); > done; > if [[ ${n} -eq 1 ]]; then > words=$(for pd in ${portdir} ; do builtin cd ${pd} ; compgen -G "*-*/*" ; done)"${sysactions}""${eactions}"; > fi; > fi; > fi; > COMPREPLY=($(for i in ${words} ; do [[ ${i} == ${cur}* ]] && echo ${i} ; done)); > else > words="$( for pd in ${portdir} ; do builtin cd ${pd} ; compgen -S '/' -G "*-*" ; done)""${sysactions}""${eactions}"; > COMPREPLY=($(compgen -W "${words}" -- ${cur})); > fi; > if [[ -z "${COMPREPLY}" ]]; then > words="$( eix ${cur}|grep '^\*'|sed 's@.*/@@' )"; > COMPREPLY=($(compgen -W "${words}" -- ${cur})); > fi; > return 0 >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 218341
: 156083 |
156085