diff options
author | Tim Harder <radhermit@gentoo.org> | 2014-11-21 09:02:24 -0500 |
---|---|---|
committer | Tim Harder <radhermit@gentoo.org> | 2014-11-21 09:02:24 -0500 |
commit | 815a24e2de9764022943d24fa81621c185cbab90 (patch) | |
tree | e25e40990caecd1bca3ef97778c192b9b14cb1a1 /src | |
parent | add _openrc to widgets to be installed and update snapshot name (diff) | |
download | zsh-completion-815a24e2de9764022943d24fa81621c185cbab90.tar.gz zsh-completion-815a24e2de9764022943d24fa81621c185cbab90.tar.bz2 zsh-completion-815a24e2de9764022943d24fa81621c185cbab90.zip |
move completions into src subdir
Diffstat (limited to 'src')
-rw-r--r-- | src/_eselect | 197 | ||||
-rw-r--r-- | src/_gcc-config | 27 | ||||
-rw-r--r-- | src/_genlop | 103 | ||||
-rw-r--r-- | src/_gentoo_packages | 309 | ||||
-rw-r--r-- | src/_gentoolkit | 382 | ||||
-rw-r--r-- | src/_layman | 51 | ||||
-rw-r--r-- | src/_openrc | 85 | ||||
-rw-r--r-- | src/_portage | 364 | ||||
-rw-r--r-- | src/_portage_utils | 270 |
9 files changed, 1788 insertions, 0 deletions
diff --git a/src/_eselect b/src/_eselect new file mode 100644 index 0000000..c012955 --- /dev/null +++ b/src/_eselect @@ -0,0 +1,197 @@ +#compdef eselect + +common_values=( + "help[Display help text]" + "usage[Display usage information]" + "version[Display version information]" +) + +_eselect_env () { + if (( $words[(I)(update)] )); then + _values "update options" \ + "makelinks[force updating of links]" \ + "noldconfig[Do not alter the ld.so cache or configuration]" && return 0 + fi + _values "env options" $common_values \ + 'update[Collect environment variables from all scripts in /etc/env.d/]' && return 0 +} + +_eselect_binutils () { + local binutilslist + if (( $words[(I)(set)] )); then + binutilslist=(${(f)"$(eselect --brief --color=no binutils list)"}) + _values "available binutils version" $binutilslist[@] && return 0 + fi + _values "binutils options" $common_values \ + "list[List all installed version of binutils]" \ + "show[Print the currently active binutils version]" \ + "set[Activate one of the installed binutils]" && return 0 +} + +_eselect_kernel () { + local kernellist + if (( $words[(I)(set)] )); then + kernellist=(${(f)"$(eselect --brief --color=no kernel list)"}) + _values "available kernel version" $kernellist[@] && return 0 + fi + _values "kernel options" $common_values \ + "list[List available kernel symlink targets]" \ + "show[Show the current kernel symlink]" \ + "set[Set a new kernel symlink target]" && return 0 +} + +_eselect_ctags () { + local ctagslist + if (( $words[(I)(set)] )); then + ctagslist=(${(f)"$(eselect --brief --color=no ctags list)"}) + _values "available ctags version" $ctagslist[@] && return 0 + fi + _values "ctags options" $common_values \ + "list[List available ctags symlink targets]" \ + "show[Show the current target of the ctags symlink]" \ + "update[Automatically update the ctags symlink]" \ + "set[Set a new ctags symlink target]" && return 0 +} + +_eselect_profile () { + local profilelist + if (( $words[(I)(set)] )); then + profilelist=(${${(f)"$(eselect --brief --color=no profile list)"}/:/\\:}) + _values -w "available profiles" $profilelist[@] \ + "--force[Forcibly set the symlink]" && return 0 + fi + _values "profile options" $common_values \ + "list[List available profile symlink targets]" \ + "show[Show the current make.profile symlink]" \ + "set[Set a new profile symlink target]" && return 0 +} + +_eselect_fontconfig () { + local fclistenabled fclistdisabled + if (( $words[(I)(enable)] )); then + fclistdisabled=(${${${${(M)${(f)"$(eselect --color=no fontconfig list)"}## *}#*\*}// \**/}//( \[*\] | \[*\] )/}) + _values -w ".conf to enable" $fclistdisabled[@] && return 0 + elif (( $words[(I)(disable)] )); then + fclistenabled=(${${${(M)${(M)${(f)"$(eselect --color=no fontconfig list)"}## *}#*\*}// \**/}//( \[*\] | \[*\] )/}) + _values -w ".conf to disable" $fclistenabled[@] && return 0 + fi + _values "fontconfig options" $common_values \ + "list[List available fontconfig .conf files]" \ + "disable[Disable specified fontconfig .conf file(s)]" \ + "enable[Enable specified fontconfig .conf file(s)]" && return 0 +} + +_eselect_opengl () { + local opengllist + if (( $words[(I)(set)] )); then + opengllist=(${(f)"$(eselect --brief --color=no opengl list)"}) + _values -w "opengl implementations and options" $opengllist[@] \ + "--use-old[If an implementation is already set, use that one instead]" \ + "--prefix[Set the source prefix]:path:_files -/" \ + "--dst-prefix[Set the destination prefix]:path:_files -/" \ + "--ignore-missing[Ignore missing files when setting a new implementation]" && return 0 + fi + _values "opengl options" $common_values \ + "list[List the available OpenGL implementations]" \ + "set[Select the OpenGL implementation]" \ + "show[Print the current OpenGL implementation]" && return 0 +} + +_eselect_vi () { + local vilist + if (( $words[(I)(set)] )); then + vilist=(${(f)"$(eselect --brief --color=no vi list)"}) + _values -w "vi implementation" $vilist[@] && return 0 + elif (( $words[(I)(update)] )); then + _values -w "option" "--if-unset[Do not override existing implementation]" && return 0 + fi + _values "vi options" $common_values \ + "list[List available vi implementations]" \ + "set[Set a new vi implementation provider]" \ + "show[Show the current vi implementation]" \ + "update[Automatically update the vi provider]" +} + +_eselect_news() { + + ## TODO: Normal numeric sorting. + ## I've spent many time on trying to rewrite this + ## function to normally sort (to DO NOT sort, actually) items, + ## but it growing bigger and bigger and going to be too complicated. + ## So, I (mva) either need to help to make it in the "right way". + ## Or, maybe, to completely rewrite this compdef. + + local -a newslist; + if ((CURRENT == 3)); then + _values 'news options' $stdopts[@] \ + 'list[List news items]' \ + 'count[Display number of news items]' \ + 'purge[Purge read news]' \ + 'read[Read news items]' \ + 'unread[Mark read news items as unread again]' && return 0 + elif ((CURRENT == 4)); then + if (( $words[(I)(count)] )); then + _values -w 'news' 'new[Count only new news items]' 'all[Count all news items]' && return 0 + fi + + newslist=(${${${${${${${(M)${(f)"$(eselect --color=no news list)"}## *}// \**/}/ \[/}/\] ##/\[}/%/]}/ \[/ (}/\] /) }) + + if (( $words[(I)(read)] )); then + newslist+=( "new[Read unread news items (default)]" "all[Read all news items]" "--mbox[Output in mbox format]" "--quiet[Suppress output, only change status]" "--raw[Output in raw format]" ) + fi; + + if (( $words[(I)(unread)] )); then + newslist+=( "all[Unread all news items]" ) + fi + + _values -w 'news' $newslist[@] && return 0 + fi +} + +_eselect () { + local globopts modnames modopts + + globopts=( + "--brief[Make output shorter]" + "--colour=no[Disable coloured output]" + "--color=no[Disable coloured output]" + ) + modnames=(${${${(M)${(f)"$(eselect --brief --color=no modules list)"}## *}// */}// /}) + + if ((CURRENT == 2)); then + _arguments -s \ + "$globopts[@]" \ + "*:portage:_values 'eselect modules' \$modnames[@]" && return 0 + elif ((CURRENT == 3)); then + if [[ $words[2] == --colour=no || $words[2] == --color=no ]]; then + _arguments -s \ + "*:portage:_values 'eselect modules' \$modnames[@]" && return 0 + elif (( $modnames[(I)$words[2]] )); then + if [[ "$words[2]" == (env|binutils|kernel|ctags|profile|fontconfig|opengl|vi|news) ]]; then + _eselect_$words[2] "$@" + else + modopts=(${${${(M)${(f)"$(eselect --brief --color=no $words[2] usage)"}## *}// */}// /}) + _arguments -s \ + "*:portage:_values 'eselect $words[2] options' \$modopts[@]" && return 0 + fi + fi + elif ((CURRENT >= 4)); then + if (( $words[(I)(--color=no|--colour=no)] )); then + if (( $modnames[(I)$words[3]] )); then + if [[ "$words[3]" == (env|binutils|kernel|ctags|profile|fontconfig|opengl|vi|news) ]]; then + _eselect_$words[3] "$@" + else + modopts=(${${${${(M)${(f)"$(eselect --brief --color=no $words[3] usage)"}## *}// */}// /}// *}) + _arguments -s \ + "*:portage:_values 'eselect $words[3] options' \$modopts[@]" && return 0 + fi + fi + else + if (( $modnames[(I)$words[2]] )); then + (( $+functions[_eselect_$words[2]] )) && _eselect_$words[2] "$@" + fi + fi + fi +} + +_eselect "$@" diff --git a/src/_gcc-config b/src/_gcc-config new file mode 100644 index 0000000..3b0fcf3 --- /dev/null +++ b/src/_gcc-config @@ -0,0 +1,27 @@ +#compdef gcc-config +#Author oberyno <oberyno@gmail.com> + +local arguments + +arguments=( + '(- :)'{--use-old,-O}'[use the old profile if one was selected]' + '(- :)'{--use-portage-chost,-P}'[only set profile if its CHOST matches /etc/{portage/}make.conf]:profiles:_gcc_profile' + '(- :)'{--get-current-profile,-c}'[print current used gcc profile]' + '(- :)'{--list-profiles,-l}'[print a list of available profiles]' + '(- :)'{--print-environ,-E}'[print environment of the given/current profile]:profiles:_gcc_profile' + '(- :)'{--get-bin-path,-B}'[print binary path of given/current profile]:profiles:_gcc_profile' + '(- :)'{--get-lib-path,-L}'[print library path of given/current profile]:profiles:_gcc_profile' + '(- :)'{--get-stdcxx-incdir,-X}'[print g++ include path of given/current profile]:profiles:_gcc_profile' + '(- :)'{--help,-h}'[show help]' + '(- :)'{--version,-v}'[show version info]' + '(- :):profiles:_gcc_profile' +) + +_gcc_profile(){ + local profile + profile=(${(f)"$(_call_program gcc-installed RC_NOCOLOR=yes gcc-config --list-profiles)"}) + profile=${${profile/\[([^]]*)\]/}/\*} + _tags profile && { compadd "$@" -k profile || compadd "$@" ${(kv)=profile} } +} + +_arguments $arguments diff --git a/src/_genlop b/src/_genlop new file mode 100644 index 0000000..322babb --- /dev/null +++ b/src/_genlop @@ -0,0 +1,103 @@ +#compdef genlop + +#genlop 0.30.8 +_genlop () { +local prev1="$words[CURRENT-1]" prev2="$words[CURRENT-2]" days months arg single state lstate +days=(monday tuesday wednesday thursday friday saturday sunday) +months=(january february march april may june july august september october november december) +arg=( --current -c --time -t --gmt -g --info -i --file -f --rsync -r --unmerge -u --date --search -s --list -l ) +single=( --current -c --pretend -p --help -h --version -v ) + + [[ ${prev2} == (1st|2nd|3rd|4th|5th) ]] && + compadd in\ $months && return 0 + [[ ${prev1} == ([2-9]|[1-9][0-9]*) && ${prev2} != \ + (january|february|march|april|may|june|july|august|september|october|november|december) ]] && + _values '' 'days ago' 'months ago' 'years ago' 'weeks ago' && return 0 + [[ ${prev1} == (1) && ${prev2} != \ + (january|february|march|april|may|june|july|august|september|october|november|december) ]] && + _values '' 'day ago' 'month ago' 'year ago' 'week ago' && return 0 + + case "$prev1" in + last) + _values '' month week + compadd $days && return 0 + ;; + 1st|2nd|3rd|4th|5th) + compadd $days && return 0 + ;; + january|february|march|april|may|june|july|august|september|october|november|december) + compadd {1..31} && return 0 + ;; + --date) + _message 'enter number for more options or use mm/dd/yyyy format' + _values '' \ + last yesterday 1st 2nd 3rd 4th 5th + _alternative \ + '*:*:_days' '*:*:_months' && return 0 + ;; + --file|-f) + _arguments '*:logfile:_files' && return 0 + ;; + *) + _arguments \ + "($single $arg *)"{--current,-c}"[display the current merge in action]" \ + "($single)*--date[specify date of event]:date:->date" \ + "($single)*-f[specify the logfile to use]:logfile:_files" \ + "($single --gmt -g)"{--gmt,-g}"[display time in GMT/UTC format (default is local time)]" \ + "($single $arg *)"{--help,-h}"[display help information]" \ + "($single --info -i --list -l)"{--info,-i}"[print brief summary about installed ebuild]" \ + "($single --search -s --info -i --list -l *)"{--list,-l}"[list merge history]" \ + "(--nocolor -n)"{--nocolor,-n}"[disable colored output]" \ + "($single $arg *)"{--pretend,-p}"[estimate build time of a piped emerge -p]" \ + "($single --search -s --info -i --time -t --unmerge -u --rsync -r *)"{--rsync,-r}"[display rsync history]" \ + "($single --rsync -r --search -s --list -l *)"{--search,-s}"[select ebuilds matching the provided regular expression]:pattern:" \ + "($single --time -t)"{--time,-t}"[display merge time]" \ + "($single --rsync -r --unmerge -u)"{--unmerge,-u}"[display when packages have been unmerged]" \ + "($single $arg *)"{--version,-v}"[display version information]" \ + "($single)*:package:_gentoo_packages available" + ;; + esac + + while [[ -n "$state" ]]; do + lstate=$state + state='' + case "$lstate" in + date) _message 'enter number for more options or use mm/dd/yyyy format' + _values '' \ + last yesterday 1st 2nd 3rd 4th 5th + _alternative \ + ':*:_days' ':*:_months' && return 0 + ;; + esac + done +} + +_days() { + local m="monday" t="tuesday" w="wednesday" T="thursday" f="friday" s="saturday" S="sunday" + local day=$(date +%u) + if [[ ${day} == 1 ]] then compadd $m + elif [[ ${day} == 2 ]] then compadd $m $t + elif [[ ${day} == 3 ]] then compadd $m $t $w + elif [[ ${day} == 4 ]] then compadd $m $t $w $T + elif [[ ${day} == 5 ]] then compadd $m $t $w $T $f + elif [[ ${day} == 6 ]] then compadd $m $t $w $T $f $s + elif [[ ${day} == 7 ]] then compadd $m $t $w $T $f $s $S + fi +} +_months() { + local j="january" f="february" m="march" a="april" M="may" ju="june" J="july" A="august" s="september" o="october" n="november" d="december" + local month=$(date +%m) + if [[ ${month} == 01 ]] then compadd $j + elif [[ ${month} == 02 ]] then compadd $j $f + elif [[ ${month} == 03 ]] then compadd $j $f $m + elif [[ ${month} == 04 ]] then compadd $j $f $m $a + elif [[ ${month} == 05 ]] then compadd $j $f $m $a $M + elif [[ ${month} == 06 ]] then compadd $j $f $m $a $M $ju + elif [[ ${month} == 07 ]] then compadd $j $f $m $a $M $ju $J + elif [[ ${month} == 08 ]] then compadd $j $f $m $a $M $ju $J $A + elif [[ ${month} == 09 ]] then compadd $j $f $m $a $M $ju $J $A $s + elif [[ ${month} == 10 ]] then compadd $j $f $m $a $M $ju $J $A $s $o + elif [[ ${month} == 11 ]] then compadd $j $f $m $a $M $ju $J $A $s $o $n + elif [[ ${month} == 12 ]] then compadd $j $f $m $a $M $ju $J $A $s $o $n $d + fi +} diff --git a/src/_gentoo_packages b/src/_gentoo_packages new file mode 100644 index 0000000..9a747b7 --- /dev/null +++ b/src/_gentoo_packages @@ -0,0 +1,309 @@ +#autoload + +setopt extendedglob bareglobqual +#Description: +# functions for gentoo packages +# inspired by _deb_packages +#Usage: _gentoo_packages installed|available|installed_versions|available_versions|binary|category|useflag + + +_portdir() { + local mainreponame mainrepopath overlayname overlaypath + + if [[ -e /usr/share/portage/config/repos.conf ]]; then + if [[ ${1} == -o ]]; then + for overlayname in $(_parsereposconf -l); do + overlaypath+=($(_parsereposconf ${overlayname} location)) + done + + source /etc/make.conf 2>/dev/null + source /etc/portage/make.conf 2>/dev/null + + overlaypath+=(${(@)PORTDIR_OVERLAY}) + + echo "${(@u)overlaypath}" + else + mainreponame=$(_parsereposconf DEFAULT main-repo) + mainrepopath=$(_parsereposconf ${mainreponame} location) + + echo "${mainrepopath}" + fi + else + source /usr/share/portage/config/make.globals 2>/dev/null + source /etc/make.conf 2>/dev/null + source /etc/portage/make.conf 2>/dev/null + + if [[ "-o" == ${1} ]]; then + echo "${(@u)PORTDIR_OVERLAY}" + else + echo "${PORTDIR}" + fi + fi +} + +_parsereposconf() { + local v f insection section arr; + + for f in /usr/share/portage/config/repos.conf \ + /etc/portage/repos.conf \ + /etc/portage/repos.conf/*.conf; do + + [[ -f ${f} ]] || continue + insection=0; + declare -A arr; + IFS='= '; + + while read -r name value; do + [[ -z ${name} || ${name} == '#'* ]] && continue + + if [[ (${name} == '['*']') && (-z ${value}) ]]; then + value=${name//(\]|\[)}; + name="section"; + fi; + arr[${name}]=${value}; + + if [[ ${insection} == 1 && ${name} == "section" ]]; then + break + elif [[ ${name} == "section" ]]; then + [[ ${value} == ${1} ]] && insection=1 + secname+=(${value}) + elif [[ ${insection} == 1 ]]; then + if [[ ${name} == ${2} ]]; then + v=${value}; + fi + fi + continue + done < ${f} + done + + if [[ "-l" == ${1} ]]; then + echo "${(@)secname}" + else + echo "${v}" + fi +} + +_parsesetsconf() { + [[ -d ${1} ]] || continue + + local v f places sections setsconf insection section arr; + + if [[ -d ${1}/sets ]]; then + setsconf=(${1}/sets/*.conf(N)); + [[ (($#setsconf > 0)) ]] && places=(${setsconf}) + elif [[ -f ${1}/sets.conf ]]; then + places=(${1}/sets.conf) + fi + + for f in ${(@)places}; do + if [[ -r ${f} ]]; then + insection=0; + declare -A arr; + IFS='= '; + while read -r name value; do + [[ -z ${name} || ${name} == '#'* ]] && continue + + if [[ (${name} == '['*']') && (-z ${value}) ]]; then + value=${name//(\]|\[)}; + name="section"; + fi; + arr[${name}]=${value}; + + if [[ ${insection} == 1 && ${name} == "section" ]]; then + [[ "sets" == ${2} ]] && [[ ! ${value} =~ "sets" ]] && sections+=(${value}) + insection=0; + elif [[ ${name} == "section" ]]; then + [[ ${value} =~ "${1:t} sets" ]] && insection=1 + [[ "sets" == ${2} ]] && [[ ! ${value} =~ "sets" ]] && sections+=(${value}) + elif [[ ${insection} == 1 ]]; then + [[ "sets" == ${2} ]] && continue + if [[ ${name} == "directory" ]]; then + v=${value}; + fi + fi + continue + done < ${f} + fi + done + + if [[ "sets" == ${2} ]]; then + [[ ((${#sections} > 0)) ]] && echo ${(@)sections} + else + [[ ((${#v} > 0)) ]] && echo ${v:t}; + fi +} + +_gentoo_packages_update_installed_sets() { + local sets; + sets=($(</var/lib/portage/world_sets)); + if [[ ((${#sets} > 0)) ]]; then + _wanted installed_sets expl 'installed set' compadd "$@" "${(o@)^sets}" + fi +} + +_gentoo_packages_update_available_sets() { + trees=($(_portdir -o) /etc/portage /usr/share/portage/config) + for PORTDIR in ${(@)trees}; do + if [[ -d ${PORTDIR} ]]; then + setsdir="$(_parsesetsconf ${PORTDIR})" + [[ ! -z "${setsdir}" ]] && setspath="${PORTDIR}/${setsdir}" || setspath="${PORTDIR}/sets" + if [[ -d "${setspath}" ]]; then + setsfiles=(${setspath}/*~*.conf(N)) + for set in ${setsfiles[@]}; do + sets+=(${set}(:t)) + done; + sets+=($(_parsesetsconf ${PORTDIR} sets)) + fi + fi + done + if [[ ((${#sets} > 0)) ]]; then + _wanted available_sets expl 'available set' compadd "$@" "@${(o@)^sets}" + fi +} + +# Completion function to show useflags. +_gentoo_packages_update_useflag(){ + local flags trees + + flags=() + trees=($(_portdir) $(_portdir -o)) + + for PORTDIR in ${trees[@]}; do + [[ -r ${PORTDIR}/profiles/use.desc ]] && + flags+=(${${(M)${(f)"$(<$PORTDIR/profiles/use.desc)"}:#* - *}%% - *}) + [[ -r ${PORTDIR}/profiles/use.local.desc ]] && + flags+=(${${${(M)${(f)"$(<$PORTDIR/profiles/use.local.desc)"}#* - *}%% - *}#*:}) + done + + compadd $flags +} + +_gentoo_packages_update_active_useflag(){ + local flags USE + var=USE + [[ -z ${(P)var} && -r /etc/portage/make.conf ]] && + local $var="`. /etc/portage/make.conf 2>/dev/null; echo ${(P)var}`" + [[ -z ${(P)var} && -r /etc/make.conf ]] && + local $var="`. /etc/make.conf 2>/dev/null; echo ${(P)var}`" + flags=(${${${=USE}%-*}%\\*}) + compadd $flags +} +_gentoo_packages_update_category(){ + local trees category + + trees=($(_portdir) $(_portdir -o)) + category=( $trees/*-*(/:t) ) + _wanted cat_packages expl 'category' compadd "$@" $category +} + +_gentoo_packages_update_installed(){ + local installed_dir installed_portage installed_list expl + installed_dir="/var/db/pkg" + installed_portage=($installed_dir/*-*/*) + + installed_pkgname=(${${installed_portage:t}%%-[0-9]*}) + _wanted packages expl 'package' compadd "$@" ${installed_pkgname} + + installed_list=( ${${installed_portage#$installed_dir/}%%-[0-9]*} ) + _wanted cat_packages expl 'category/package' _multi_parts "$@" / installed_list +} + +_gentoo_packages_update_installed_versions(){ + local installed_list installed_portage expl + + installed_portage=(/var/db/pkg/*-*/*) + _wanted packages expl 'package' compadd "$@" ${installed_portage:t} + + installed_list=(${installed_portage##*/pkg/}) + _wanted cat_packages expl 'category/package' _multi_parts "$@" / installed_list +} + +_gentoo_packages_update_available_pkgnames_only(){ + local trees packages + + trees=($(_portdir) $(_portdir -o)) + + packages=($trees/*-*/*(:t)) + _wanted packages expl 'package' compadd - "${(@)packages}" +} + +_gentoo_packages_update_available(){ + local trees category packages pkg expl + + trees=($(_portdir) $(_portdir -o)) + category=($trees/*-*(/:t)) + + packages=($trees/*-*/*(:t)) + _wanted packages expl 'package' compadd - "${(@)packages}" + + # Complete cat/pkg. _multi_parts is much to slow for such a large task, + # _sep_parts removes the dash from gnome-<tab>, and _path_files wants to + # complete cat/pkg/files (if "files" is ignored with -F, miscfiles, etc... + # don't get completed). + if [[ $PREFIX != */* ]] ; then + _wanted cat_packages expl 'category/package' compadd -S '/' $category + else + compset -P '*/' + pkg=($trees/$IPREFIX/*(:t)) + _wanted cat_packages expl 'category/package' compadd $pkg + fi +} + +_gentoo_packages_update_available_versions(){ + local var overlay_ebuilds portage_ebuilds expl trees category + + PORTDIR=$(_portdir) + PORTDIR_OVERLAY=$(_portdir -o); + + trees=($PORTDIR $=PORTDIR_OVERLAY) + category=($trees/*-*(/:t)) + typeset -U category + + if [[ $#PREFIX -ge 1 && -z $words[(r)(--inject|-i)] ]] ; then + overlay_ebuilds=($=PORTDIR_OVERLAY/*-*/${PREFIX%%-[0-9]#*}*/*.ebuild(:t:r) ) + portage_ebuilds=($PORTDIR/metadata/cache/*-*/${PREFIX%%-[0-9]#*}*(:t)) + _wanted packages expl 'package' compadd $portage_ebuilds $overlay_ebuilds + fi + pkg=( $trees/${PREFIX%%/*}/*/*.ebuild(:t:r) ) + _wanted cat_packages expl 'category/package' _sep_parts category / pkg +} + +#Function to show tbz2 files available +_gentoo_packages_update_binary() { + [[ -z $PKGDIR && -r /etc/portage/make.conf ]] && + local PKGDIR="`. /etc/portage/make.conf 2>/dev/null; echo $PKGDIR`" + [[ -z $PKGDIR && -r /etc/make.conf ]] && + local PKGDIR="`. /etc/make.conf 2>/dev/null; echo $PKGDIR`" + [[ -z $PKGDIR && -r /usr/share/portage/config/make.globals ]] && + local PKGDIR="`. /usr/share/portage/config/make.globals 2>/dev/null; echo $PKGDIR`" + + # this doesn't take care of ${PORTAGE_BINHOST}. If Gentoo official + # binary mirror will be available we should rewrite it accordingly. + _path_files -g \*.tbz2 -W "$PKGDIR/All" +} + +_gentoo_packages () { + local command="$argv[$#]" expl cachevar pkgset update_policy + zstyle -s ":completion:*:*:$service:*" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:*:*:$service:*" cache-policy _gentoo_cache_policy + fi + [[ "$command" == (installed(_versions|_sets|)|available(_versions|_sets|_pkgnames_only|)|binary|category|(active_|)useflag) ]] || { + _message "unknown command: $command" + return + } + [[ "$pkgset" == (installed(_versions|_sets|)|available(_versions|_sets|_pkgnames_only|)|binary|category|(active_|)useflag) ]] || { + pkgset="$command" + } + expl=("${(@)argv[1,-2]}") + _gentoo_packages_update_$pkgset +} + +_gentoo_cache_policy () { + # rebuild if cache is more than a week old + oldp=( "$1"(mw+1) ) + (( $#oldp )) && return 0 +} + + +_gentoo_packages "$@" diff --git a/src/_gentoolkit b/src/_gentoolkit new file mode 100644 index 0000000..ef3db9a --- /dev/null +++ b/src/_gentoolkit @@ -0,0 +1,382 @@ +#compdef equery euse eclean eclean-dist eclean-pkg epkginfo genpkgindex glsa-check revdep-rebuild + +# gentoolkit-0.2.4-rc3 +# +# euse (fully done) +# equery (fully done) +# eclean* (fully done) +# epkginfo (fully done) +# genpkgindex (fully done) +# glsa-check (fully done) +# revdep-rebuild (partial) +# eread *nothing todo* + + +# XXX: shouldn't this go to _gentoo_package? +_packages () { + if compset -P '(\\|)(>=|<=|<|>|=)' ; then + _gentoo_packages ${*/(#m)(installed|available)/${MATCH}_versions} + else + _gentoo_packages $* + fi +} + + +_euse () { + local state tmp start_args suboptions_args + start_args=( + {'(--help)-h','(-h)--help'}'[show help]' + {'(--version)-v','(-v)--version'}'[show version]' + {'(--info)-i','(-i)--info'}'[show descriptions for the given useflags]' + {'(--active)-a','(-a)--active'}'[show currently active useflags and their origin]' + {'(--enable)-E','(-E)--enable'}'[enable the given useflags]' + {'(--disable)-D','(-D)--disable'}'[disable the given useflags]' + {'(--prune)-P','(-P)--prune'}'[show version]' + ) + suboptions_args=( + {'(--global)-g','(-g)--global'}'[show only global use flags]' + {'(--local)-l','(-l)--local'}'[show only local use flags]' + ) + if (( CURRENT == 2 ));then + _arguments -s $start_args + elif (( CURRENT == 3 ));then + case "$words[2]" in + -i|--info|-a|--active) + _arguments -s $suboptions_args \ + '*:useflags:_gentoo_packages useflag' && ret=0 + ;; + -E|--enable) + _arguments \ + '*:useflags:_gentoo_packages useflag' && ret=0 + ;; + -D|--disable) + _arguments \ + '*:active useflags:_gentoo_packages active_useflag' && ret=0 + esac + else + _arguments \ + '*:useflag:_gentoo_packages useflag' && ret=0 + fi +} + + +_equery () { + # Based off of X/_xauth. + local state context line expl ret=1 + local tmp cmd start_args common_args + + start_args=( + {'(--nocolor)-C','(-C)--nocolor'}'[turns off colors]' + {'(--quiet)-q','(-q)--quiet'}'[minimal output]' + {'(--help)-h','(-h)--help'}'[show help]' + {'(--version)-V','(-V)--version'}'[show version]' + ) + + common_args=( + '(-i --installed -I --exclude-installed)'{-i,--installed}'[search installed packages]' + '(-I --exclude-installed -i --installed)'{-I,--exclude-installed}'[do not search installed packages]' + '(-p --portage)'{-p,--portage-tree}'[also search in portage tree]' + '(-o --overlay-tree)'{-o,--overlay-tree}'[also search in overlay tree]' + ) + + + _arguments -s $start_args \ + '*::command:->command' && ret=0 + + while [[ -n "$state" ]]; do + tmp="$state" + state= + case "$tmp" in + command) + if (( CURRENT == 1 )); then + state=subcommands + else + cmd="$words[1]" + curcontext="${curcontext%:*:*}:equery-${cmd}:" + case "$cmd" in + belongs|b) + _arguments \ + '(-c --category)'{-c,--category}'[only search in specified category]:category:_gentoo_packages category' \ + '(-e --earlyout)'{-e,--earlyout}'[stop when first match found]' \ + '(-f --full-regex)'{-f,--full-regex}'[supplied query is a full regex]:pattern:' \ + '*:file:_files' && ret=0 + ;; + check|k) + _arguments \ + ':portage:_packages installed' && ret=0 + ;; + depends|d) + _arguments \ + '(-a --all-packages)'{-a,--all-packages}'[search in all available packages (slow)]:all packages:->packages' \ + '(-d --direct -D --indirect)'{-d,--direct}'[search direct dependencies only (default)]' \ + '(-d --direct -D --indirect)'{-D,--indirect}'[search indirect dependencies (VERY slow)]' \ + '*:package:_packages installed' && ret=0 + ;; + depgraph|g) + _arguments \ + '(-U --no-useflags)'{-U,--no-useflags}'[do not show USE flags]' \ + '(-l --linear)'{-l,--linear}'[do not use fancy formatting]' \ + ':package:_packages installed' && ret=0 + ;; + files|f) + _arguments \ + '--timestamp[append timestamp]' \ + '--md5sum[append md5sum]' \ + '--type[prepend file type]' \ + '--filter=[filter output]:filter(s):_values -s , '' dir obj sym dev fifo path conf cmd doc man info' \ + ':installed pkgname:_packages installed' && ret=0 + ;; + meta|m) + _arguments \ + '(-d --description)'{-d,--description}'[show an extended package description]' \ + '(-H --herd)'{-H,--herd}'[show the herd(s) for the package]' \ + '(-k --keywords)'{-k,--keywords}'[show keywords for all matching package versions]' \ + '(-m --maintainer)'{-m,--maintainer}'[show the maintainer(s) for the package]' \ + '(-S --stablreq)'{-S,--stablreq}'[show STABLEREQ arches (ccs) for all matching package versions]' \ + '(-u --useflags)'{-u,--useflags}'[show per-package USE flag descriptions]' \ + '(-U --upstream)'{-U,--upstream}'[show packages upstream information]' \ + '(-x --xml)'{-x,--xml}'[show the plain metadata.xml file]' \ + ':package:_packages available' && ret=0 + ;; + hasuse|h) + _arguments \ + $common_args \ + ':useflag:_gentoo_packages useflag' && ret=0 + ;; + list|l) + _arguments \ + $common_args \ + ': :_guard "^--*" pattern' && ret=0 + ;; + size|s) + _arguments \ + '(-b --bytes)'{-b,--bytes}'[report size in bytes]' \ + ':package:_packages installed' && ret=0 + ;; + which|w) + _arguments \ + ':portage:_packages available' && ret=0 + ;; + uses|u) + _arguments \ + {--all,-a}'[include non-installed packages]' \ + ":portage:_packages installed" && ret=0 + ;; + changes|c) + _arguments \ + '(-l --latest)'{-l,--latest}'[only display latest ChangeLog entry]' \ + '(-f --full)'{-f,--full}'[display full ChangeLog entry]' \ + ':portage:_packages available' && ret=0 + ;; + *) + _message 'command not found' + ;; + esac + fi + ;; + subcommands) + tmp=( + {belongs,b}'[list all packages owning file(s)]' + {check,k}'[check MD5sums and timestamps of package]' + {changes,c}'[shows ChangeLog for specified package]' + {depends,d}'[list all packages depending on specified package]' + {depgraph,g}'[display a dependency tree for package]' + {files,f}'[list files owned by package]' + {hasuse,h}'[list all packages with specified useflag]' + {list,l}'[list all packages matching pattern]' + {size,s}'[print size of files contained in package]' + {uses,u}'[display USE flags for package]' + {which,w}'[print full path to ebuild for package]' + {has,a}'[list all packages matching ENVIRONMENT data stored in /var/db/pkg]' + {keywords,y}'[display keywords for specified PKG]' + {meta,m}'[display metadata about PKG]' + ) + _values 'equery command' $tmp && ret=0 + ;; + esac + done +} + + +_eclean_wrapper () { + local global_opts pkg_opts dist_opts + + global_opts=( + '(-C --nocolor)'{-C,--nocolor}'[turns off colors]' + '(-d,--destructive)'{-d,--destructive}'[only keep the minimum for a reinstallation]' + '(-e,--exclude-file)'{-e,--exclude-file}'[path to the exclusion file]:filename:_files' + '(-i,--interactive)'{-i,--interactive}'[ask confirmation before deletions]' + '(-n,--package-names)'{-n,--package-names}'[protect all versions (when --destructive)]' + '(-p,--pretend)'{-p,--pretend}'[only display what would be cleaned]' + '(-q,--quiet)'{-q,--quiet}'[minimal output]' + '(-t,--time-limit)'{-t,--time-limit}'[don’t delete files modified since <time>]:time:_eclean_time' + '(: -)'{-h,--help}'[show help]' + '(: -)'{-V,--version}'[show version]' + ) + dist_opts=( + '(-s,--size-limit)'{-s,--size-limit}'[do not delete disfiles bigger than <size>]:size:_eclean_size' + '(-f,--fetch-restricted)'{-f,--fetch-restricted}'[protect fetch-restricted files]' + ) + # XXX: If you add options here make sure that it'll work. + # since there isn't any option *right* now, $pkg_opts + # is never used. + pkg_opts=() + + # check which kind of eclean command we run. + case "$words[1]" in + eclean-pkg) + _arguments -s $global_opts $pkg_opts && + return 0 + ;; + eclean-dist) + _arguments -s $global_opts $dist_opts && + return 0 + ;; + eclean) + # eclean. complete only specifics options if an action has been given, + # global_opts and packages|distfiles otherwhise. + if (( $words[(I)(packages)] )); then + # Currently no options so return 0 + #_values "packages options" $pkg_opts && + return 0 + elif (( $words[(I)(distfiles)] )); then + _values "distfiles options" $dist_opts && + return 0 + else + _arguments -s $global_opts + # complete packages|distfiles only if CURRENT-1 don't need an arg + if [[ ! $words[CURRENT-1] =~ -(e|-exclude-file|t|-time-limit|s|-size-limit|h|-help|v|-version) ]]; then + _values 'eclean command' \ + 'packages[clean outdated binary packages]' \ + 'distfiles[clean outdated packages sources files]' && + return 0 + fi + fi + ;; + esac +} +_eclean_time () { + # adapted from _chmod + compset -P '*' + suf=( -S '' ) + _alternative -O suf \ + 'number:number:(0 1 2 3 4 5 6 7 8 9)' \ + 'time_unit:time_unit:((y\:year m\:month w\:week d\:day h\:hour))' && + return 0 +} +_eclean_size () { + # adapted from _chmod + compset -P '*' + suf=( -S '' ) + _alternative -O suf \ + 'number:number:(0 1 2 3 4 5 6 7 8 9)' \ + 'time_unit:time_unit:((G\:gigabytes M\:megabytes K\:kilobytes B\:bytes))' && + return 0 +} + + +_epkginfo () { + if (( CURRENT == 2 )); then + _arguments -s '*:package:_gentoo_packages available' + fi +} + + +_genpkgindex () { + _arguments -s \ + '(: -)'{-h,--help}'[Display help and exit]' \ + '(-h --help -q --quiet -v --verbose)'{-q,--quiet}'[Be quiet]' \ + '(-h --help -q --quiet -v --verbose)'{-v,--verbose}'[Be verbose]' \ + '(-h --help -c --compress)'{-c,--compress}'[Compresses the generated metadata with bzip2]' \ + '(-h --help -P --pkgdir)'{-P,--pkgdir}'[Set the base location of the binary packages (default $PKGDIR)]:file:_files' +} + + +_glsa-check () { + local actions + + actions=(-l --list -d --dump --print -t --test -p --pretend -f --fix -i --inject -h --help -V --version -m --mail) + + _arguments -s \ + "($actions)"{-l,--list}'[list all unapplied GLSA]:glsa_id:_glsa_id' \ + "($actions)"{-d,--dump,--print}'[show all information about the given GLSA]:glsa_id:_glsa_id' \ + "($actions)"{-t,--test}'[test if this system is affected by the given GLSA]:glsa_id:_glsa_id' \ + "($actions)"{-p,--pretend}'[show the necessary commands to apply this GLSA]:glsa_id:_glsa_id' \ + "($actions)"{-f,--fix}'[try to auto-apply this GLSA (experimental)]:glsa_id:_glsa_id' \ + "($actions)"{-i,--inject}'[inject the given GLSA into the checkfile]:glsa_id:_glsa_id' \ + '(-n --nocolor)'{-n,--nocolor}'[disable colors (option)]' \ + '(: -)'{-h,--help}'[Show help message]' \ + '(: -)'{-V,--version}'[some information about this tool]' \ + '(-v --verbose)'{-v,--verbose}'[print more messages (option)]' \ + '(-c --cve)'{-c,--cve}'[show CAN ids in listing mode (option)]' \ + "($actions)"{-m,--mail}'[send a mail with the given GLSAs to the administrator]:glsa_id:_glsa_id' +} +# glsa-list can contain an arbitrary number of GLSA ids, +# filenames containing GLSAs or the special identifiers +# 'all', 'new' and 'affected' +_glsa_id () { +# XXX: we'll avoid displaying GLSA ids, because the ratio use/noise +# will be low. May be we should display only the X previous GLSA, +# or GLSA ids of the X last month. +# +# start to look at /usr/lib/gentoolkit/pym/glsa.py if GLSA_DIR is still +# PORTDIR + "metadata/glsa/" +# and then get the list (it's only xml files in GLSA_DIR, easy!) + + compadd 'all' 'new' 'affected' + _files +} + + +_revdep-rebuild () { + if (( $words[(I)(--)] )); then + # here it's no more revdep-rebuild options, but emerge options that are called + # FIXME: not working yet. need to load the _portage file + _arguments -s '*:portage:_portage --emerge $@' && return 0 + fi + + _arguments -s \ + '(-C --nocolor)'{-C,--nocolor}'[Turn off colored output]' \ + '(-d --debug)'{-d,--debug}'[Print way too much information (uses bash set -xv)]' \ + '(-e --exact)'{-e,--exact}'[Emerge based on exact package version]' \ + '(: -)'{-h,--help}'[Print help]' \ + '(-i --ignore)'{-i,--ignore}'[Ignore temporary files from previous runs]' \ + '(-k --keep-temp)'{-k,--keep-temp}'[Do not delete temporary files on exit]' \ + '(-L --library)'{-L,--library}'[<NAME> Emerge existing packages that use the library with NAME]:file:_files' \ + '(-l --no-ld-path)'{-l,--no-ld-path}'[Do not set LD_LIBRARY_PATH]' \ + '(-o --no-order)'{-o,--no-order}'[Do not check the build order (Saves time, but may cause breakage)]' \ + '(-p --pretend)'{-p,--pretend}'[Do a trial run without actually emerging anything (also passed to emerge command)]' \ + '(-P --no-progress)'{-P,--no-progress}'[Turn off the progress meter]' \ + '(-q --quiet)'{-q,--quiet}'[Be less verbose (also passed to emerge command)]' \ + '(-v --verbose)'{-v,--verbose}'[Be more verbose (also passed to emerge command)]' \ + '(-u --no-util)'{-u,--no-util}'[<UTIL> Do not use features provided by UTIL]:file:_files' + # XXX: does someone really use -u|--no-util option? + # we can check packages installed (like portage-utils etc) to see + # which "UTIL" is avaiable. +} + + +case "$service" in + euse) + _euse "$@" && return 0 + ;; + equery) + _equery "$@" && return 0 + ;; + eclean*) + _eclean_wrapper "$@" && return 0 + ;; + epkginfo) + _epkginfo "$@" && return 0 + ;; + genpkgindex) + _genpkgindex "$@" && return 0 + ;; + glsa-check) + _glsa-check "$@" && return 0 + ;; + revdep-rebuild) + _revdep-rebuild "$@" && return 0 + ;; +esac + diff --git a/src/_layman b/src/_layman new file mode 100644 index 0000000..52e775f --- /dev/null +++ b/src/_layman @@ -0,0 +1,51 @@ +#compdef layman + +# layman-1.1.1 +# +local arguments actions_args actions global_opts add_actions +_layman_remote_overlays() { + local layman_list_overlays + layman_list_overlays=(${(S)${${(f)"$(layman -k -N -L 2>/dev/null)"}//\[*}#\* }) + compadd "$@" ${(kv)=layman_list_overlays} "ALL" +} +_layman_local_overlays() { + local layman_list_overlays + layman_list_overlays=(${(S)${${(f)"$(layman -N -l)"}//\[*}#\* }) + compadd "$@" ${(kv)=layman_list_overlays} "ALL" +} +actions=( + --delete -d + --sync -s + --info -i + --sync-all -S + --list -L + --list-local -l + --fetch -f +) + +global_opts=( + '(--config -c)'{-c,--config}'[Select an alternative configuration file]:configuration file:_files' + '(--overlays -o)'{-o,--overlays}'[Specifies the location of additional overlay lists]:overlay url:_urls' + '(--nofetch -n)'{-n,--nofetch}'[Prevents from automatically fetching the remote lists of overlays]' + '(--nocheck -k)'{-k,--nocheck}'[Prevents from checking the remote lists of overlays for complete overlay definitions]' + '(--quiet -q)'{-q,--quiet}'[Makes layman completely quiet]' + '(--verbose -v)'{-v,--verbose}'[Verbose output]' + '(--quietness -Q)'{-Q,--quietness}'[Makes layman less verbose]:level:({0..4})' + '(--nocolor -N)'{-N,--nocolor}'[Remove color codes from the output]' +) +add_actions=( + -p --priority + --add -a +) +actions_args=( + "($actions --add -a)"{--add,-a}'[Add the given overlay to your installed overlays]:overlay:_layman_remote_overlays' + "($actions --priority -p)"{--priority,-p}'[It will modify the priority of the added overlay]:priority:({0..100})' + "($actions $add_actions)"{--delete,-d}'[Delete the given overlay from your installed overlays]:overlay:_layman_local_overlays' + "($actions $add_actions)"{--sync,-s}'[Update the specified overlay]:overlat:_layman_local_overlays' + "($actions $add_actions)"{--info,-i}'[Display all available information about the specified overlay]:overlay:_layman_remote_overlays' + "($actions $add_actions)"{--sync-all,-S}'[Update all overlays]' + "($actions $add_actions)"{--list,-L}'[List the contents of the remote list]' + "($actions $add_actions)"{--list-local,-l}'[List the locally installed overlays]' + "($actions $add_actions)"{--fetch,-f}'[Fetches the remote list of overlays]' +) +_arguments $global_opts[@] $actions_args[@] diff --git a/src/_openrc b/src/_openrc new file mode 100644 index 0000000..84ecbc8 --- /dev/null +++ b/src/_openrc @@ -0,0 +1,85 @@ +#compdef rc-update rc-status rc rc-service + +# openrc-0.12.4 + +local gentoo_runlevels +gentoo_runlevels=(/etc/runlevels/*(:t)) + +case "$service" in + rc-service) + if (( CURRENT == 2 )); then + _arguments -s \ + '(-e --exists)'{-e,--exists}"[tests if the service exists or not]" \ + '(-l --list)'{-l,--list}'[list all available services]' \ + '(-r --resolve)'{-r,--resolve}'[resolve the service name to an init script]' \ + '(-C --nocolor)'{-C,--nocolor}'[Disable color output]' \ + '(-v --verbose)'{-v,--verbose}'[Run verbosely]' \ + '(-q --quiet)'{-q,--quiet}'[Run quietly]' + _values "service" /etc/init.d/*~*.sh(:t) + else + case $words[2] in + -e|--exists|-r|--resolve) + (( CURRENT > 3 )) && return 0 + _values "service" /etc/init.d/*~*.sh(:t) + ;; + -*) + return 0 + ;; + *) + _values "action" stop start restart describe zap + ;; + esac + fi + ;; + rc-update) + local used_init + used_init=(${=${(M)${(f)"$(/sbin/rc-update show 2>/dev/null)"}:#*|*[a-z]*}% |*}) + + if (( CURRENT == 2 )); then + _values "rc-update actions" \ + 'add[Add script to a runlevel]' \ + 'del[Delete script from a runlevel]' \ + 'show[Show scripts lanched at a runlevel]' \ + '-a[Add script to a runlevel]' \ + '-d[Delete script from a runlevel]' \ + '-s[Show scripts lanched at a runlevel]' + elif (( CURRENT == 3 )); then + case "$words[2]" in + add|-a) + _values "service" /etc/init.d/*~*.sh(:t) + ;; + del|-d) + _values "service" $used_init + ;; + show|-s) + _values "runlevels" $gentoo_runlevels \ + '-v[Show all init scripts]' \ + '--verbose[Show all init scripts]' + ;; + esac + elif (( CURRENT == 4 )); then + _values "runlevels" $gentoo_runlevels + fi + ;; + rc-status) + _arguments -s \ + {'(--all)-a','(-a)--all'}'[Show services at all runlevels]' \ + {'(--crashed)-c','(-c)--crashed'}'[Show crashed services]' \ + {'(--list)-l','(-l)--list'}'[Show list of runlevels]' \ + {'(--runlevel)-r','(-r)--runlevel'}'[Show the name of the current runlevel]' \ + {'(--servicelist)-s','(-s)--servicelist'}'[Show all services]' \ + {'(--unused)-u','(-u)--unused'}'[Show services not assigned to any run level]' \ + {'(--help)-h','(-h)--help'}'[Print this help output]' \ + {'(--nocolor)-C','(-C)--nocolor'}'[Disable color output]' \ + {'(--version)-V','(-V)--version'}'[Display software version]' \ + {'(--verbose)-v','(-v)--verbose'}'[Run verbosely]' \ + {'(--quiet)-q','(-q)--quiet'}'[Run quietly (Does not affect errors)]' + + _values 'runlevels' $gentoo_runlevels + ;; + rc) + if (( CURRENT == 2 )); then + _values "runlevels" $gentoo_runlevels + fi + ;; +esac diff --git a/src/_portage b/src/_portage new file mode 100644 index 0000000..57fc0a5 --- /dev/null +++ b/src/_portage @@ -0,0 +1,364 @@ +#compdef emerge ebuild quickpkg emaint env-update portageq repoman tbz2tool + +# Already done: +# emerge (fully done) +# ebuild (fully done) +# emaint (fully done) +# env-update (fully done) +# portageq (fully done) +# repoman (fully done) +# tbz2tool (fully done) +# +# Still TODO: +# xpak + + +# Stuff for ebuild +_ebuild () { + if (( CURRENT == 2 ));then + _files -g \*.ebuild + elif (( CURRENT > 2 ));then + _values "ebuild command" \ + 'clean[Cleans the temporary build directory]' \ + 'help[Show help]' \ + 'setup[Run all package specific setup actions and exotic system checks.]' \ + 'fetch[Fetch all necessary files]' \ + 'digest[Creates a digest file for the package]' \ + 'unpack[Extracts the sources to a subdirectory in the build directory]' \ + 'compile[Compiles the extracted sources by running the src_compile()]' \ + 'preinst[Run specific actions that need to be done before installation]' \ + 'install[Installs the package to the temporary install directory]' \ + 'postinst[Run specific actions that need to be done after installation]' \ + 'qmerge[Installs the package de the filesystem]' \ + 'merge[perform the following actions: fetch, unpack, compile, install and qmerge.]' \ + 'unmerge[Remove the installed files of the packages]' \ + 'prerm[Run specific actions that need to be executed before unmerge]' \ + 'postrm[Run specific actions that need to be executed after unmerge]' \ + 'config[Run specific actions needed to be executed after the emerge process has completed.]' \ + 'package[This command is a lot like the merge command, but create a .tbz2 package]' \ + 'manifest[Updates the manifest file for the package.]' \ + 'rpm[Builds a RedHat RPM package]' + fi + +} + + +# Stuff for quickpkg + +_quickpkg () { + if compset -P '(\\|)(>=|<=|<|>|=)'; then + _arguments -s \ + '*:installed package:_gentoo_packages installed_versions' + elif compset -P '(\\|)[/]'; then + _path_files -W / -/ + else + _arguments \ + '*:installed package:_gentoo_packages installed' + fi +} + +# Stuff for emerge + +_emerge () { + local nopkg_opts all noask_opts bopts install_args common_args profiles + + noask_opts=(-p -a --pretend --ask --regen --info --search -s --searchdesc \ + -S --version -V --help -h --metadata --check-news) + + nopkg_opts=(--resume --skipfirst -c --clean -h --help --depclean --info \ + --metadata -P --prune --regen -s --search -S --searchdesc --sync -C \ + --unmerge -V --version -i --inject --list-sets --deselect --check-news) + + bopts=($nopkg_opts -b --buildpkg -B --buildpkgonly -G --getbinpkgonly -g \ + --getbinpkg -k --usepkg -K --usepkgonly --fetch-all-uri -f -F --fetchonly) + + all=($bopts -l --changelog --columns --deep -D --emptytree -e --newuse \ + --noconfmem --nodeps -O --noreplace -n --oneshot -1 -o --onlydeps --tree -t \ + -u --update -U --upgradeonly --config) + + common_args=( + "($noask_opts --sync)"{-p,--pretend}"[Simply display what would be done]" + "($noask_opts)"{-a,--ask}"[Ask what would be done]" + '(-d --debug --help -h --version -V)'{-d,--debug}'[Tells emerge to run the emerge command in debug mode]' + '(--quiet -q --verbose -v)'{-q,--quiet}'[General outcome is a reduced or condensed output]' + '(--verbose -v --quiet -q)'{-v,--verbose}'[Tell emerge to run in verbose mode]' + '--nospinner[Disables the spinner for the session]' + '(: -)'{-h,--help}'[Displays help]' + "(: -)--config[Run package specific actions needed to be executed after the emerge process has completed]:installed atom:_gentoo_packages installed" + "(: -)--list-sets[Displays a list of available package sets]" + "--color=[Color output]:yes/no:((y\:'yes' n\:'no'))" + "--accept-properties=[Temporarily override the ACCEPT_PROPERTIES variable]" + "--accept-restrict=[Temporarily override the ACCEPT_RESTRICT variable]" + "($noask_opts)"{-A,--alert=}"[Add a terminal bell to all interactive prompts]:yes/no:((y\:'yes' n\:'no'))" + "--ignore-default-opts[Ignore EMERGE_DEFAULT_OPTS]" + "--moo[Have you mooed today?]" + ) + install_args=( + '--deselect=[Remove atom from world file]:yes/no:((y\:'yes' n\:'no'))' + "--alphabetical[Sort use/other flags output alphabetically despite of status]" + "--ask-enter-invalid[When with --ask, interpret a single 'Enter' key press as invalid input]" + "--autounmask[Automatically unmask packages and generate package.use]:yes/no:((y\:'yes' n\:'no'))" + "--autounmask-unrestricted-atoms[Use >= for autounmask if possible]:yes/no:((y\:'yes' n\:'no'))" + "--autounmask-keep-masks[Don't unmask hardmasks and unkeyworded (live)]:yes/no:((y\:'yes' n\:'no'))" + "--autounmask-write[Automatically write autounmask changes (respect CONFIG_PROTECT)]:yes/no:((y\:'yes' n\:'no'))" + "--backtrack=[Number of times to backtrack if dependency calculation fails]:number:(0 10 30)" + "--binpkg-respect-use=[Ignore binary packages if their uses don't match current config]:yes/no:((y\:'yes' n\:'no'))" + "--complete-graph=[Consider the deep dependencies of all packages from the world set]:yes/no:((y\:'yes' n\:'no'))" + "--complete-graph-if-new-use=[--complete-graph if USE or IUSE will change for an installed package]:yes/no:((y\:'yes' n\:'no'))" + "--complete-graph-if-new-ver=[--complete-graph if an installed package version will change]:yes/no:((y\:'yes' n\:'no'))" + "--config-root=[Set PORTAGE_CONFIGROOT variable]:root path:_files -/" + "--depclean-lib-check=[Check library link-level dependencies]:yes/no:((y\:'yes' n\:'no'))" + "--digest[Prevent corruption from being noticed]" + "--dynamic-deps=[Substitute the dependencies of installed packages with the dependencies of corresponding unbuilt ebuilds]:yes/no:((y\:'yes' n\:'no'))" + "--fail-clean=[Clean up temporary files after a build failure]:yes/no:((y\:'yes' n\:'no'))" + "--ignore-built-slot-operator-deps=[Ignore the slot/sub-slot dependencies for built pkg]:yes/no:((y\:'yes' n\:'no'))" + "(: $nopkg_opts)"{-j,--jobs=}"[Number of packages to build simultaneously]:jobs:({1.."${#${$(</proc/cpuinfo)/^processor}}"})" + "--keep-going[Continue as much as possible after an error]:yes/no:((y\:'yes' n\:'no'))" + "--load-average[No new builds should be started if there are other builds running and the load average is at least VALUE]" + "--misspell-suggestions[Enable or disable misspell suggestions]:yes/no:((y\:'yes' n\:'no'))" + "--newrepo[Recompile a package if it is now being pulled from a different repository]" + "--usepkg-exclude[Ignore matching binary packages]:installed atom:_gentoo_packages installed" + "--rebuild-exclude[Do not rebuild matching packages on --rebuild]:installed atom:_gentoo_packages installed" + "--rebuild-ignore[Do not rebuild packages that depend on matching packages on --rebuild]:installed atom:_gentoo_packages installed" + "--package-moves[Perform package moves when necessary]:yes/no:((y\:'yes' n\:'no'))" + "--pkg-format[Binary package format]:archive type:(tar rpm)" + "--prefix=[Set EPREFIX env variable]:prefix path:_files -/" + "--quiet-build=[Redirect all build output to logs]:yes/no:((y\:'yes' n\:'no'))" + "--quiet-fail=[Suppresses display of the build log on stdout]:yes/no:((y\:'yes' n\:'no'))" + "--quiet-repo-display[Suppress ::repository in output (and use numbers)]" + "--quiet-unmerge-warn[Disable the warning message on --unmerge and friends]" + "--rebuild-if-new-slot[Automatically rebuild or reinstall packages when dependencies can be satisfied by a newer slot]:yes/no:((y\:'yes' n\:'no'))" + "--rebuild-if-new-rev[Rebuild packages when build-time dependencies are built from source, if the dependency is not already installed with the same version and revision]:yes/no:((y\:'yes' n\:'no'))" + "--rebuild-if-new-ver[Rebuild packages when build-time dependencies are built from source, if the dependency is not already installed with the same version]:yes/no:((y\:'yes' n\:'no'))" + "--rebuild-if-unbuilt[Rebuild packages when build-time dependencies are built from source]:yes/no:((y\:'yes' n\:'no'))" + "--rebuilt-binaries[Replace installed packages with binary packages that have been rebuilt]:yes/no:((y\:'yes' n\:'no'))" + "--rebuilt-binaries-timestamp[Only binaries older than TIMESTAMP will be considered by the rebuilt-binaries logic]:TIMESTAMP" + "--reinstall[Alias for --changed-use (currently)]:reinstall opts:(changes-use)" + "--reinstall-atoms[Treat matching packages as if they are not installed]:installed atoms:_gentoo_packages installed" + "--root=[Set ROOT env variable]:prefix path:_files -/" + "(: $nopkg_opts)"{-w,--select=}"[Add specified packages to the world set (inverse of --oneshot)]:yes/no:((y\:'yes' n\:'no'))" + "--selective=[Use --selective=n if you want to forcefully disable --selective, regardless of options like --changed-use, --newuse, --noreplace, or --update]:yes/no:((y\:'yes' n\:'no'))" + "--unordered-display[Produce more readable package tree with --tree]" + "--use-ebuild-visibility[Use unbuilt ebuild metadata for visibility checks on built packages]:yes/no:((y\:'yes' n\:'no'))" + "--useoldpkg-atoms[Prefer matching binary packages over newer unbuilt packages]:available atom:_gentoo_packages available" + "($bopts)"{-b,--buildpkg=}"[Tells emerge to build binary packages]:(y n)" + "($bopts)--buildpkg-exclude[Space separated list of package atoms for which no binary packages should be built]" + "($bopts)--exclude[Space separated list of package names or slot atoms which should not be installed]" + "($bopts)"{-B,--buildpkgonly}"[Tells emerge to only build binary packages]" + "($nopkg_opts --emptytree -e -l --changelog --usepkgonly -K)"{-l,--changelog}"[This will show the ChangeLog]" + "($nopkg_opts -t --tree)--columns[Displays versions in aligned format]" + "($nopkg_opts -D --deep --newuse -N --changed-use)"{-D,--deep}"[Consider the entire dependency tree of packages]" + "($nopkg_opts -D --deep --newuse -N --changed-use)"{-N,--newuse}"[Include installed packages where any USE flags have changed since compilation.]" + "($nopkg_opts -D --deep --newuse -N --changed-use)--changed-use[Include installed packages where enabled USE flags have changed since installation]" + "($nopkg_opts -e -l --changelog --emptytree)"{-e,--emptytree}"[Only consider glibc as installed packages]" + "($all --nospinner --pretend -p)"{-i,--inject}"[Portage thinks that this package is installed]" + "($nopkg_opts $bopts)"{-f,--fetchonly}"[Just perform fetches for all packages]" + "($nopkg_opts $bopts)"{-F,--fetch-all-uri}"[Fetch all possible files for all packages]" + "($bopts)"{-g,--getbinpkg}"[Tells emerge to download binary package]" + "($bopts)"{-G,--getbinpkgonly}"[As --getbinpkg, but does not use local info]" + "($nopkg_opts)--noconfmem[Causes portage to disregard merge records]" + "($nopkg_opts -O --nodeps)"{-O,--nodeps}"[Merges specified packages without merging dependencies]" + "($nopkg_opts -n --noreplace)"{-n,--noreplace}"[Skip packages already installed]" + "($nopkg_opts)"{-1,--oneshot}"[Do not add package to the world profile]" + "($nopkg_opts --onlydeps -o)"{-o,--onlydeps}"[Only merge (or pretend to merge) the dependencies]" + "($nopkg_opts --columns -t --tree)"{-t,--tree}"[Show dependency tree]" + "($nopkg_opts --update -u)"{-u,--update}"[Updates packages to the most recent version available]" + "($nopkg_opts --upgradeonly -U)"{-U,--upgradeonly}"[Do not update packages to a lower version]" + "($bopts)"{-k,--usepkg}"[Tells emerge to use binary packages if available]" + "($bopts --changelog -l)"{-K,--usepkgonly}"[Tells emerge to use binary packages only]" + "($all)--clean[Cleans the system by removing packages]" + "(: $all)"{-c,--depclean}"[Clean all packages that have no reason for being installed (see man!!!)]" + "(: $all $noask_opts --nospinner --quiet -q)--info[This is a list of information to include in bug reports]" + "(: -)--metadata[Generate metadata]" + "($nopkg_opts --usepkgonly -K)--newuse[Include installed packages which have changed USE flags]" + "($all)"{-P,--prune}"[Removes all but the latest versions of matching packages]" + "(: $all $noask_opts --verbose -v)--regen[Causes portage to check and update the dependency cache]" + "(: $all $noask_opts --verbose -v)"{-s,--search}"[Searches for matches]" + "(: $all $noask_opts --verbose -v)"{-S,--searchdesc}"[Matches the seachdesc string against the description field]" + "(: $all --pretend -p)--sync[Initiates a portage tree update]" + "(: $all --pretend -p)--check-news[Scan all repositories for relevant unread GLEP 42 news items]" + "($all)"{-C,--unmerge}"[Removes all matching packages]" + '(: -)'{-V,--version}'[Display version info]' + "(: $all[3,-1])--resume[Resumes the last merge operation]" + "(: $all[3,-1])--skipfirst[Removes the first package in the resume list]" + ) + profiles=( + 'world[All packages in the world profile]' + 'system[All packages in the system profile]' + ) + + + # Dispatch + if (( $words[(I)(--(unmerge|clean|prune|deselect)|-[[:alpha:]]#(C|c|P)[[:alpha:]]#)] )) ; then + if compset -P '(\\|)(>=|<=|<|>|=)'; then + _arguments -s \ + '*:installed package:_gentoo_packages installed_versions' && return 0 + else + _arguments -s \ + "$common_args[@]" "$install_args[@]" \ + "*:installed package:_gentoo_packages installed" \ + "::installed sets:_gentoo_packages installed_sets" \ + && return 0 + fi + + elif (( $words[(I)(world|system)] )) ; then + _arguments -s \ + "$common_args[@]" "$install_args[@]" \ + "($nopkg_opts[1,-2] --inject -i --oneshot -1):" && return 0 + + elif (( $words[(I)(--usepkgonly|-[[:alnum:]]#K[[:alnum:]]#)] )) ; then + _arguments -s \ + "$common_args[@]" "$install_args[@]" \ + '*:binary package:_gentoo_packages binary' && return 0 + + else + if compset -P '(\\|)(>=|<=|<|>|=)'; then + _arguments \ + "*:portage:_gentoo_packages available_versions" && return 0 + elif (( $words[(I)(--inject|-i)] )) ; then + _arguments -s \ + "$common_args[@]" "$install_args[@]" \ + "*:portage:_gentoo_packages available_versions" && return 0 + else + _arguments -s \ + "$common_args[@]" "$install_args[@]" \ + "($nopkg_opts)::portage: _values 'profile' \$profiles[@] " \ + "($nopkg_opts)*:portage:_gentoo_packages available" \ + "($nopkg_opts)::available sets:_gentoo_packages available_sets" \ + && return 0 + fi + fi +} + + +_emaint () { + _arguments -s \ + "(: -)"{-h,--help}'[show help message and exit]' \ + "(: -)"--version"[show program's version number and exit]" \ + '(-c --check -f --fix)'{-c,--check}"[Check for any problems that may exist]:emaint:((all\:'check all' world\:'check only world file'))" \ + '(-c --check -f --fix)'{-f,--fix}"[Fix any problems that may exist]:emaint:((all\:'check all' world\:'check only world file'))" +} + + +_env-update () { + _arguments -s '(: -)--no-ldconfig[Do not run ldconfig]' +} + + +_portageq () { + local action + + action="$words[2]" + + if (( CURRENT == 2 )); then + _values 'command' \ + '--help[Show help]' \ + 'config_protect_mask[Returns the CONFIG_PROTECT_MASK paths]' \ + 'config_protect[Returns the CONFIG_PROTECT paths]' \ + 'portdir[Returns PORTDIR paths]' \ + 'contents[List the files that are installed for a given package]' \ + 'vdb_path[Returns the path used for the var(installed) package database]' \ + 'gentoo_mirrors[Returns the mirrors set to use in the portage configuration]' \ + 'exithandler[MISSING DOCUMENTATION!]' \ + 'all_best_visible[Returns all best_visible packages (without .ebuild)]' \ + 'match[Returns a \n separated list of category/package-version]' \ + 'metadata[Returns metadata values for the specified package]' \ + 'best_visible[Returns category/package-version (without .ebuild)]' \ + 'mass_best_visible[Returns category/package-version (without .ebuild)]' \ + "has_version[Return code 0 if it's available, 1 otherwise]" \ + 'envvar[Returns a specific environment variable as exists prior to ebuild.sh]' \ + 'pkgdir[Returns the PKGDIR path]' \ + 'best_version[Returns category/package-version (without .ebuild)]' \ + 'mass_best_version[Returns category/package-version (without .ebuild)]' \ + 'portdir_overlay[Returns the PORTDIR_OVERLAY path]' \ + 'distdir[Returns the DISTDIR path]' \ + 'owners[print the packages that own the files and which files belong to each package]' + elif (( CURRENT == 3 )); then + if [[ "$action" =~ (contents|(all_|mass_|)best_visible|match|metadata|(has|best)_version|owners|mass_best_version) ]]; then + _arguments -s '*:root:_files -g /' + fi + elif (( CURRENT > 3 )); then + if [[ "$action" =~ ((mass_|)best_(visible|version)|has_version) ]]; then + _arguments -s '*:package:_gentoo_packages available' + elif [[ "$action" == owners ]]; then + _arguments -s '*:root:_files' + fi + fi +} + + +_repoman () { + local previous + + previous="$words[CURRENT-1]" + + _arguments -s \ + '(--force)'--force'[Force commit to proceed, regardless of QA issues]' \ + '(-q --quiet -v --verbose)'{-q,--quiet}'[Be less verbose about extraneous info]' \ + '(-p --pretend -m --commitmsg -M --commitmsgfile)'{-p,--pretend}'[Don’t commit or fix anything; just show what would be done]' \ + '(-i --include-masked)'{-i,--include-masked}'[Include masked packages in scans at category or tree level]' \ + '(-x --xmlparse)'{-x,--xmlparse}'[Forces the metadata.xml parse check to be carried out]' \ + '(-q --quiet -v --verbose)'{-v,--verbose}'[Displays every package name while checking]' \ + '(-I --ignore-arches)'{-I,--ignore-arches}'[Ignore arch-specific failures (where arch != host)]' \ + '(-m --commitmsg -M --commitmsgfile)'{-m,--commitmsg}'[Adds a commit message via the command line]:message:' \ + '(-m --commitmsg -M --commitmsgfile)'{-M,--commitmsgfile}'[Adds a commit message from the specified file]:commit_file:_files' \ + '(: -)'{-V,--version}'[Show version info]' \ + '(: -)'{-h,--help}'[Show this screen]' + + # if we don't have an option that cancel action, or if we don't already have an action. + if ! [[ "$previous" =~ (-h|-V|-m|-M|--version|--help|--commitmsg|--commitmsgfile) ]] && + ! (( $words[(I)(full|last|help|scan|fix|lfull|manifest|commit)] )); then + _values 'action' \ + 'full[Scan directory tree for QA issues (full listing)]' \ + 'last[Remember report from last run]' \ + 'help[Show this screen]' \ + 'scan[Scan directory tree for QA issues (short listing)]' \ + 'fix[Fix simple QA issues (stray digests, missing digests)]' \ + 'lfull[Remember report from last run (full listing)]' \ + 'manifest[Generate a Manifest (fetches files if necessary)]' \ + 'commit[Scan directory tree for QA issues; if OK, commit via cvs]' + fi +} + + +_tbz2tool () { + if (( CURRENT == 2 )); then + _values 'action' 'join' 'split' + elif (( CURRENT > 2 )) && (( CURRENT < 6 )); then + _arguments -s '*:file:_files' + fi +} + + +zparseopts -D -E -A Args -- -emerge +if (( ${+Args[--emerge]} ));then + _emerge "$@" && return 0 +fi + +case "$service" in + emerge) + _emerge "$@" && return 0 + ;; + ebuild) + _ebuild "$@" && return 0 + ;; + quickpkg) + _quickpkg "$@" && return 0 + ;; + emaint) + _emaint "$@" && return 0 + ;; + env-update) + _env-update "$@" && return 0 + ;; + portageq) + _portageq "$@" && return 0 + ;; + repoman) + _repoman "$@" && return 0 + ;; + tbz2tool) + _tbz2tool "$@" && return 0 + ;; +esac + diff --git a/src/_portage_utils b/src/_portage_utils new file mode 100644 index 0000000..dbb45d6 --- /dev/null +++ b/src/_portage_utils @@ -0,0 +1,270 @@ +#compdef qatom qcache qcheck qdepends qfile qgrep qlist qlop qpkg qsearch qsize qtbz2 quse qxpak + +# portage-utils-0.53 + + +_portdir() { + local mainreponame mainrepopath overlayname overlaypath + + if [[ -e /usr/share/portage/config/repos.conf ]]; then + if [[ ${1} == -o ]]; then + for overlayname in $(_parsereposconf -l); do + overlaypath+=($(_parsereposconf ${overlayname} location)) + done + + source /etc/make.conf 2>/dev/null + source /etc/portage/make.conf 2>/dev/null + + overlaypath+=(${PORTDIR_OVERLAY}) + + # strip out duplicates + overlaypath=($(printf "%s\n" "${overlaypath[@]}" | sort -u)) + + echo "${overlaypath[@]}" + else + mainreponame=$(_parsereposconf DEFAULT main-repo) + mainrepopath=$(_parsereposconf ${mainreponame} location) + + echo "${mainrepopath}" + fi + else + source /usr/share/portage/config/make.globals 2>/dev/null + source /etc/make.conf 2>/dev/null + source /etc/portage/make.conf 2>/dev/null + + echo "${PORTDIR}" + + if [[ ${1} == -o ]]; then⋅ + echo "${PORTDIR_OVERLAY}" + fi⋅⋅⋅ + fi +} + +_parsereposconf() { + local f insection line section v value var + + for f in /usr/share/portage/config/repos.conf \ + /etc/portage/repos.conf \ + /etc/portage/repos.conf/*.conf; do + + [[ -f ${f} ]] || continue + insection=0 + + while read -r line; do + # skip comments and blank lines + [[ -z ${line} || ${line} == '#'* ]] && continue + + if [[ ${insection} == 1 && ${line} == '['*']' ]]; then + # End of the section we were interested in so stop + secname+=(${line//[(\[|\])]/}) # record name for -l + break + elif [[ ${line} == '['*']' ]]; then + # Entering a new section, check if it's the one we want + section=${line//[(\[|\])]/} + [[ ${section} == "${1}" ]] && insection=1 + secname+=(${section}) # record name for -l + elif [[ ${insection} == 1 ]]; then + # We're in the section we want, grab the values + var=${line%%=*} + var=${var// /} + value=${line#*=} + value=${value# } + [[ ${var} == ${2} ]] && v=${value} + fi + continue + done < "${f}" + done + + if [[ ${1} == -l ]]; then + echo "${secname[@]}" + else + echo "${v}" + fi +} + + +local common_args PORTDIR + +PORTDIR="$(_portdir)" + +common_args=( + '--root[Set the ROOT env var]:root directory:_files -/' \ + {'(--verbose)-v','(-v)--verbose'}'[Make a lot of noise]' \ + {'(--quiet)-q','(-q)--quiet'}'[Tighter output; suppress warnings]' \ + {'(--nocolor)-C','(-C)--nocolor'}'[Do not output color]' \ + {'(--help)-h','(-h)--help'}'[Print this help and exit]' \ + {'(--version)-V','(-V)--version'}'[Print version and exit]' \ +) + +case $service in + qatom) + _arguments -s $common_args \ + {'(--compare)-c','(-c)--compare'}'[Compare two atoms]' + ;; + qcache) + local arch + local -a arches allarches + + show_archs(){ + arches=(${(f)"$(<$PORTDIR/profiles/arch.list)"}) + for arch in $arches; do + [[ $arch =~ '^[^#]' ]] && allarches+=( $arch ) + done + _describe -t available-arches "arch" allarches + } + + _arguments -s $common_args \ + {'(--matchpkg)-p','(-p)--matchpkg'}'[match pkgname]:package name:_gentoo_packages available_pkgnames_only' \ + {'(--matchcat)-c','(-c)--matchcat'}'[match catname]:category:_gentoo_packages category' \ + {'(--imlate)-i','(-i)--imlate'}'[list packages that can be marked stable on a given arch]' \ + {'(--dropped)-d','(-d)--dropped'}'[list packages that have dropped keywords on a version bump on a given arch]' \ + {'(--testing)-t','(-t)--testing'}'[list packages that have ~arch versions, but no stable versions on a given arch]' \ + {'(--stats)-s','(-s)--stats'}'[display statistics about the portage tree]' \ + {'(--all)-a','(-a)--all'}'[list packages that have at least one version keyworded for on a given arch]' \ + {'(--not)-n','(-n)--not'}"[list packages that aren't keyworded on a given arch]" \ + '*:arch:show_archs' + ;; + qcheck) + _arguments -s $common_args \ + {'(--all)-a','(-a)--all'}'[List all packages]' \ + {'(--exact)-e','(-e)--exact'}'[Exact match (only CAT/PN or PN without PV)]' \ + {'(--skip)-s','(-s)--skip'}'[Ignore files matching regular expression]:regex' \ + {'(--update)-u','(-u)--update'}'[Update missing files, chksum and mtimes for packages]' \ + {'(--noafk)-A','(-A)--noafk'}'[Ignore missing files]' \ + {'(--badonly)-B','(-B)--badonly'}'[Only print pkgs containing bad files]' \ + {'(--nohash)-H','(-H)--nohash'}'[Ignore differing/unknown file chksums]' \ + {'(--nomtime)-T','(-T)--nomtime'}'[Ignore differing file mtimes]' \ + '--skip-protected[Ignore files in CONFIG_PROTECT-ed paths]' \ + {'(--prelink)-p','(-p)--prelink'}'[Undo prelink when calculating checksums]' \ + '*:packages:_gentoo_packages installed' + ;; + qdepends) + _arguments -s $common_args \ + {'(--depend)-d','(-d)--depend'}'[Show DEPEND info (default)]' \ + {'(--rdepend)-r','(-r)--rdepend'}'[Show RDEPEND info]' \ + {'(--pdepend)-p','(-p)--pdepend'}'[Show PDEPEND info]' \ + {'(--key)-k','(-k)--key'}'[User defined vdb key]:vdb key' \ + {'(--query)-Q','(-Q)--query'}'[Query reverse deps]' \ + {'(--name-only)-N','(-N)--name-only'}'[Only show package name]' \ + {'(--all)-a','(-a)--all'}'[Show all DEPEND info]' \ + {'(--format)-f','(-f)--format'}'[Pretty format specified depend strings]' \ + '*:packages:_gentoo_packages installed' + ;; + qfile) + _arguments -s $common_args \ + {'(--slots)-S','(-S)--slots'}'[Display installed packages with slots]' \ + {'(--root-prefix)-R','(-R)--root-prefix'}'[Assume arguments are already prefixed by $ROOT]' \ + {'(--from)-f','(-f)--from'}'[Read arguments from file <arg> ("-" for stdin)]' \ + {'(--max-args)-m','(-m)--max-args'}'[Treat from file arguments by groups of <arg> (defaults to 5000)]:number' \ + {'(--basename)-b','(-b)--basename'}'[Match any component of the path]' \ + {'(--orphans)-o','(-o)--orphans'}'[List orphan files]' \ + {'(--exclude)-x','(-x)--exclude'}"[Don't look in package <arg> (used with --orphans)]:package:_gentoo_packages installed" \ + {'(--exact)-e','(-e)--exact'}'[Exact match (used with --exclude)]' \ + '*:filename:_files' + ;; + qgrep) + _arguments -s $common_args \ + {'(--invert-match)-I','(-I)--invert-match'}'[Select non-matching lines]' \ + {'(--ignore-case)-i','(-i)--ignore-case'}'[Ignore case distinctions]' \ + {'(--with-filename)-H','(-H)--with-filename'}'[Print the filename for each match]' \ + {'(--with-name)-N','(-N)--with-name'}'[Print the package or eclass name for each match]' \ + {'(--count)-c','(-c)--count'}'[Only print a count of matching lines per FILE]' \ + {'(--list)-l','(-l)--list'}'[Only print FILE names containing matches]' \ + {'(--invert-list)-L','(-L)--invert-list'}'[Only print FILE names containing no match]' \ + {'(--regexp)-e','(-e)--regexp'}'[Use PATTERN as a regular expression]' \ + {'(--extended)-x','(-x)--extended'}'[Use PATTERN as an extended regular expression]' \ + {'(--installed)-J','(-J)--installed'}'[Search in installed ebuilds instead of the tree]' \ + {'(--eclass)-E','(-E)--eclass'}'[Search in eclasses instead of ebuilds]' \ + {'(--skip-comments)-s','(-s)--skip-comments'}'[Skip comments lines]' \ + {'(--skip)-S','(-S)--skip'}'[Skip lines matching <arg>]:pattern' \ + {'(--before)-B','(-B)--before'}'[Print <arg> lines of leading context]:number' \ + {'(--after)-A','(-A)--after'}'[Print <arg> lines of trailing context]:number' \ + '*:pattern::' + ;; + qlist) + _arguments -s $common_args \ + {'(--installed)-I','(-I)--installed'}'[Just show installed packages]' \ + {'(--slots)-S','(-S)--slots'}'[Display installed packages with slots]' \ + {'(--repo)-R','(-R)--repo'}'[Display installed packages with repository]' \ + {'(--umap)-U','(-U)--umap'}'[Display installed packages with flags used]' \ + {'(--columns)-c','(-c)--columns'}'[Display column view]' \ + '--show-debug[Show /usr/lib/debug files]' \ + {'(--exact)-e','(-e)--exact'}'[Exact match (only CAT/PN or PN without PV)]' \ + {'(--all)-a','(-a)--all'}'[Show every installed package]' \ + {'(--dir)-d','(-d)--dir'}'[Only show directories]' \ + {'(--obj)-o','(-o)--obj'}'[Only show objects]' \ + {'(--sym)-s','(-s)--sym'}'[Only show symlinks]' \ + '*:packages:_gentoo_packages installed' + ;; + qlop) + _arguments -s $common_args \ + {'(--gauge)-g','(-g)--gauge'}'[Gauge number of times a package has been merged]' \ + {'(--time)-t','(-t)--time'}'[Calculate merge time for a specific package]' \ + {'(--human)-H','(-H)--human'}'[Print seconds in human readable format (needs -t)]' \ + {'(--list)-l','(-l)--list'}'[Show merge history]' \ + {'(--unlist)-u','(-u)--unlist'}'[Show unmerge history]' \ + {'(--sync)-s','(-s)--sync'}'[Show sync history]' \ + {'(--current)-c','(-c)--current'}'[Show current emerging packages]' \ + {'(--logfile)-f','(-f)--logfile'}'[Read emerge logfile instead of /var/log/emerge.log]:log:_files' \ + '*:packages:_gentoo_packages available' + ;; + qsearch) + _arguments -s $common_args \ + {'(--all)-a','(-a)--all'}'[List the descriptions of every package in the cache]' \ + {'(--cache)-c','(-c)--cache'}'[Use the portage cache]' \ + {'(--ebuilds)-e','(-e)--ebuilds'}'[Use the portage ebuild tree]' \ + {'(--search)-s','(-s)--search'}'[Regex search package basenames]' \ + {'(--desc)-S','(-S)--desc'}'[Regex search package descriptions]' \ + {'(--name-only)-N','(-N)--name-only'}'[Only show package name]' \ + {'(--homepage)-H','(-H)--homepage'}'[Show homepage info]' \ + '*:pattern::' + ;; + qsize) + _arguments -s $common_args \ + {'(--filesystem)-f','(-f)--filesystem'}'[Show size used on disk]' \ + {'(--all)-a','(-a)--all'}'[Size all installed packages]' \ + {'(--sum)-s','(-s)--sum'}'[Include a summary]' \ + {'(--sum-only)-S','(-S)--sum-only'}'[Show just the summary]' \ + {'(--megabytes)-m','(-m)--megabytes'}'[Display size in megabytes]' \ + {'(--kilobytes)-k','(-k)--kilobytes'}'[Display size in kilobytes]' \ + {'(--bytes)-b','(-b)--bytes'}'[Display size in bytes]' \ + {'(--ignore)-i','(-i)--ignore'}'[Ignore regexp string]:pattern' \ + '*:packages:_gentoo_packages installed' + ;; + quse) + _arguments -s $common_args \ + {'(--exact)-e','(-e)--exact'}'[Show exact non regexp matching using strcmp]' \ + {'(--all)-a','(-a)--all'}'[Show annoying things in IUSE]' \ + {'(--keywords)-K','(-K)--keywords'}'[Use the KEYWORDS vs IUSE]' \ + {'(--license)-L','(-L)--license'}'[Use the LICENSE vs IUSE]' \ + {'(--describe)-D','(-D)--describe'}'[Describe the USE flag]' \ + {'(--format)-F','(-F)--format'}'[Use your own variable formats: -F NAME=]:format' \ + {'(--name-only)-N','(-N)--name-only'}'[Only show package name]' \ + '*:use flag:_gentoo_packages useflag' + ;; + qtbz2) + _arguments -s $common_args \ + {'(--dir)-d','(-d)--dir'}'[Change to specified directory]:directory:_files -/' \ + {'(--join)-j','(-j)--join'}'[Join tar.bz2 + xpak into a tbz2]:*:tar.bz2 file and xpak file:_files -g \*.\(tar.bz2\|xpak\)' \ + {'(--split)-s','(-s)--split'}'[Split a tbz2 into a tar.bz2 + xpak]:tbz2 file:_files -g \*.tbz2' \ + {'(--tarbz2)-t','(-t)--tarbz2'}'[Just split the tar.bz2]:tbz2 file:_files -g \*.tbz2' \ + {'(--xpak)-x','(-x)--xpak'}'[Just split the xpak]:tbz2 file:_files -g \*.tbz2' \ + {'(--stdout)-O','(-O)--stdout'}'[Write files to stdout]' + ;; + qpkg) + _arguments -s $common_args \ + {'(--clean)-c','(-c)--clean'}'[clean pkgdir of unused binary files]' \ + {'(--eclean)-E','(-E)--eclean'}'[clean pkgdir of files not in the tree anymore (slow)]' \ + {'(--pretend)-p','(-p)--pretend'}'[pretend only]' \ + {'(--pkgdir)-P','(-P)--pkgdir'}'[alternate package directory]:alternate pkgdir:_files -/' \ + '*:Installed packages:_gentoo_packages installed_versions' + ;; + qxpak) + _arguments -s $common_args \ + {'(--list)-l','(-l)--list'}'[List the contents of an archive]:xpak archive:_files -g \*.xpak' \ + {'(--extract)-x','(-x)--extract'}'[Extract the contents of an archive]:xpak archive:_files -g \*.xpak' \ + {'(--create)-c','(-c)--create'}'[Create an archive of a directory/files]:*:archive name and files to archive:_files' \ + {'(--dir)-d','(-d)--dir'}'[Change to specified directory]:directory:_files -/' \ + {'(--stdout)-O','(-O)--stdout'}'[Write files to stdout]' + ;; +esac |