diff options
author | Tristan Heaven <nyhm@gentoo.org> | 2008-05-13 23:40:03 +0000 |
---|---|---|
committer | Tristan Heaven <nyhm@gentoo.org> | 2008-05-13 23:40:03 +0000 |
commit | 09f8c6e287ffe5854e536c75e2bc7e26acb31f88 (patch) | |
tree | 7db980dd13c9f58cf81bc02a56e8edc886eef972 | |
parent | Update emerge action completion #125128. (diff) | |
download | gentoo-bashcomp-09f8c6e287ffe5854e536c75e2bc7e26acb31f88.tar.gz gentoo-bashcomp-09f8c6e287ffe5854e536c75e2bc7e26acb31f88.tar.bz2 gentoo-bashcomp-09f8c6e287ffe5854e536c75e2bc7e26acb31f88.zip |
revert that for now
svn path=/trunk/; revision=64
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | gentoo | 62 |
2 files changed, 33 insertions, 30 deletions
@@ -5,7 +5,6 @@ ChangeLog for gentoo-bashcomp * Removed herdstat functions as they're included with herdstat now. * Use source instead of sed to get PORTDIR/PORTDIR_OVERLAY #182809. * Update completion for euse and glsa-check. - * Update emerge action completion #125128. 2005-06-14 Aaron Walker <ka0ttic@gentoo.org> @@ -295,7 +295,7 @@ _emerge() { local c cur prev curword numwords opts cond prepend local words stopre stophere i x - local action actionpos sysactions pkgpos + local action actionpos actionre sysactions eactions pkgpos local version_mode searchdesc_mode help_mode resume_mode local portdir=$(_portdir -o) COMPREPLY=() @@ -303,7 +303,8 @@ _emerge() prev="${COMP_WORDS[COMP_CWORD-1]}" numwords=${#COMP_WORDS[*]} curword=${COMP_CWORD} - stopre='--@(depclean|metadata|regen|sync)' + 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 @@ -313,7 +314,7 @@ _emerge() # find action for x in ${COMP_LINE} ; do - if [[ ${x} == -* ]] ; then + if [[ ${x} == ${actionre} ]] ; then action=${x} break fi @@ -330,10 +331,11 @@ _emerge() if [[ ${action} == -* && ${action} != --* ]] ; then case "${action}" in - -*C*) action='--unmerge' ;; - -*P*) action='--prune' ;; - -*c*) action='--clean' ;; - -*s*) action='--search' ;; + -*C*) action='unmerge' ;; + -*P*) action='prune' ;; + -*c*) action='clean' ;; + -*i*) action='inject' ;; + -*s*) action='search' ;; esac fi else @@ -352,8 +354,8 @@ _emerge() [[ ${COMP_LINE} == *" "-@(h|-help)* ]] && help_mode=1 # Handle special cases. - if [[ "${action}" == '--search' ]] || [[ -n "${searchdesc_mode}" ]] || \ - [[ -n "${version_mode}" ]] + if [[ "${action}" == 'search' ]] || [[ -n "${searchdesc_mode}" ]] || \ + [[ -n "${version_mode}" ]] || [[ "${action}" == 'metadata' ]] then unset COMPREPLY return 0 @@ -377,37 +379,32 @@ _emerge() fi elif [[ "${cur}" == --* ]]; then # Complete on long options. - opts="--alphabetical --ask \ + opts="--ask --autoclean \ --buildpkg --buildpkgonly \ - --changelog --clean --color --columns --complete-graph --config \ - --debug --deep --depclean \ + --changelog --clean --columns \ + --debug --deep \ --emptytree \ --fetch-all-uri --fetchonly \ --getbinpkg --getbinpkgonly \ - --info \ - --metadata \ - --newuse --noconfmem --nodeps --noreplace --nospinner \ + --newuse --noconfmem --nodeps --noreplace --nospinner --oneshot --onlydeps \ - --pretend --prune \ + --pretend \ --quiet \ - --reinstall --regen \ - --search \ --sync \ --tree \ - --unmerge --update --upgradeonly --usepkg --usepkgonly \ - --verbose \ - --with-bdeps" + --update --upgradeonly --usepkg --usepkgonly \ + --verbose --depclean --info --search" if [[ ${curword} -eq 1 ]] && [[ ${numwords} -eq 2 ]] ; then opts="${opts} --help --resume --searchdesc --version" fi elif [[ "${cur}" == -* ]]; then # Complete on short options. - opts="-B -D -G -K -N -O -a -b -d -e -f -g -k -l -n -o -p -q -t -u -v" + 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 -s" + opts="${opts} -C -P -c -i -s" fi fi @@ -439,7 +436,7 @@ _emerge() fi # Complete on installed packages when unmerging. - if [[ "${action}" == '--unmerge' ]]; then + if [[ "${action}" == 'unmerge' ]]; then if [[ -n "${cur}" ]] ; then if [[ "${cur}" == */* ]]; then words=$(builtin cd /var/db/pkg; compgen -G "${cur}*") @@ -597,7 +594,11 @@ _emerge() # Complete on packages. if [[ ${COMP_CWORD} -eq 1 ]] ; then - sysactions=$'\n'"system"$'\n'"world" + if [[ $numwords -le 2 ]]; then + sysactions=$'\n'"system"$'\n'"world"$'\n'"sync"$'\n'"metadata" + else + sysactions=$'\n'"system"$'\n'"world"$'\n'"sync" + fi else # Only allow these actions if no packages have been specified. # @@ -619,6 +620,9 @@ _emerge() fi fi + if [[ -z "${action}" ]] && [[ ${curword} -le ${pkgpos} ]] ; then + eactions=$'\n'"clean"$'\n'"depclean"$'\n'"inject"$'\n'"prune"$'\n'"regen"$'\n'"search"$'\n'"unmerge" + fi if [[ -n "${cur}" ]] ; then if [[ ${cur} == virtual/* ]] ; then words=$(\ @@ -634,13 +638,13 @@ _emerge() for pd in ${portdir} ; do \ builtin cd ${pd}; \ compgen -X "*metadata.xml" -G "${cur}*" ; \ - done)"${sysactions}" + done)"${sysactions}""${eactions}" else local ww=$(\ for pd in ${portdir} ; do \ builtin cd ${pd} ; \ compgen -S '/' -G "${cur}*"; \ - done)"${sysactions}" + done)"${sysactions}""${eactions}" # complete on virtuals ww="${ww} $(\ for pd in ${portdir} ; do \ @@ -665,7 +669,7 @@ _emerge() words=$(for pd in ${portdir} ; do \ builtin cd ${pd} ; \ compgen -G "*-*/*" ; \ - done)"${sysactions}" + done)"${sysactions}""${eactions}" fi fi COMPREPLY=($(for i in ${words} ; do \ @@ -676,7 +680,7 @@ _emerge() for pd in ${portdir} ; do \ builtin cd ${pd} ; \ compgen -S '/' -G "*-*" ; \ - done)""${sysactions}" + done)""${sysactions}""${eactions}" COMPREPLY=($(compgen -W "${words}" -- ${cur})) fi |