├── AUTHORS ├── COPYING ├── README.rst └── src ├── _binutils-config ├── _ekeyword ├── _eselect ├── _g-cpan ├── _gcc-config ├── _genlop ├── _gentoo_arches ├── _gentoo_packages ├── _gentoo_repos ├── _gentoo_repos_conf ├── _gentoolkit ├── _layman ├── _perl-cleaner ├── _portage └── _portage_utils /AUTHORS: -------------------------------------------------------------------------------- 1 | Baptiste Daroussin 2 | David Durrleman 3 | oberyno 4 | Tim Harder 5 | Vadim A. Misbakh-Soloviov 6 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | The Z Shell is copyright (c) 1992-2001 Paul Falstad, Richard Coleman, 2 | Zoltán Hidvégi, Andrew Main, Peter Stephenson, Sven Wischnowsky, and 3 | others. All rights reserved. Individual authors, whether or not 4 | specifically named, retain copyright in all changes; in what follows, they 5 | are referred to as `the Zsh Development Group'. This is for convenience 6 | only and this body has no legal status. The Z shell is distributed under 7 | the following licence; any provisions made in individual files take 8 | precedence. 9 | 10 | Permission is hereby granted, without written agreement and without 11 | licence or royalty fees, to use, copy, modify, and distribute this 12 | software and to distribute modified versions of this software for any 13 | purpose, provided that the above copyright notice and the following 14 | two paragraphs appear in all copies of this software. 15 | 16 | In no event shall the Zsh Development Group be liable to any party for 17 | direct, indirect, special, incidental, or consequential damages arising out 18 | of the use of this software and its documentation, even if the Zsh 19 | Development Group have been advised of the possibility of such damage. 20 | 21 | The Zsh Development Group specifically disclaim any warranties, including, 22 | but not limited to, the implied warranties of merchantability and fitness 23 | for a particular purpose. The software provided hereunder is on an "as is" 24 | basis, and the Zsh Development Group have no obligation to provide 25 | maintenance, support, updates, enhancements, or modifications. 26 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | gentoo-zsh-completions 2 | ====================== 3 | 4 | This project focuses on providing Zsh completion support to various Gentoo 5 | tools that lack completion scripts upstream. 6 | -------------------------------------------------------------------------------- /src/_binutils-config: -------------------------------------------------------------------------------- 1 | #compdef binutils-config 2 | 3 | local arguments 4 | 5 | arguments=( 6 | '(- :)'{--get-current-profile,-c}'[print current profile]' 7 | '(- :)'{--list-profiles,-l}'[print a list of available profiles]' 8 | {'(--uninstall)-u','(-u)--uninstall'}'[remove all signs of specified target]' 9 | {'(--debug)-d','(-d)--debug'}'[execute with debug output]' 10 | '(- :)'{--help,-h}'[show help]' 11 | '(- :):profiles:_binutils_profiles' 12 | ) 13 | 14 | _binutils_profiles() { 15 | local profiles 16 | profiles=(${(f)"$(_call_program binutils-installed RC_NOCOLOR=yes binutils-config --list-profiles)"}) 17 | profiles=${${profiles/\[([^]]*)\]/}/\*} 18 | _tags profiles && { compadd "$@" -k profiles || compadd "$@" ${(kv)=profiles} } 19 | } 20 | 21 | _arguments $arguments 22 | 23 | # vim: set et sw=2 ts=2 ft=zsh: 24 | -------------------------------------------------------------------------------- /src/_ekeyword: -------------------------------------------------------------------------------- 1 | #compdef ekeyword 2 | 3 | local -a arguments=( 4 | '(- :)'{-h,--help}'[Show this help message and exit]' 5 | '(-m --manifest)'{-m,--manifest}'[Run `ebuild manifest` on the ebuild after modifying it]' 6 | '(-n --dry-run)'{-n,--dry-run}'[Show what would be changed, but do not commit]' 7 | '(-v --verbose)'{-v,--verbose}'[Be verbose while processing things]' 8 | '(-q --quiet)'{-q,--quiet}'[Be quiet while processing things (only show errors)]' 9 | '(--format)'--format':Select output format for showing differences:_values -V ekeywordsfmt "ekeywords formats" auto color-inline inline short-multi long-multi' 10 | '(- :)'{-V,--version}'[Show version information]' 11 | ) 12 | 13 | (( $+functions[_ekeywordargs] )) || _ekeywordargs() { 14 | _files -g \*.ebuild 15 | 16 | local -a keywords=(all $(_gentoo_arches)) 17 | 18 | compset -P '(\^|\~)' 19 | _values -V "keywords" "gentoo arches" ${keywords[@]} 20 | } 21 | 22 | _arguments ${arguments[@]} "*:ekeywordargs:_ekeywordargs" 23 | 24 | -------------------------------------------------------------------------------- /src/_eselect: -------------------------------------------------------------------------------- 1 | #compdef eselect kernel-config profile-config rc-config 2 | 3 | _eselect_parse_generic() { 4 | local -a mod_std mod_extra 5 | local -a eselect_args 6 | local mod_cur eselect_descr 7 | local mod descr etype 8 | 9 | eselect_args=($@) 10 | if [[ $1 == "modules" ]] ; then 11 | eselect_args=($1 usage) 12 | fi 13 | mod_cur="mod_extra" 14 | eselect_descr="$(LANG=C COLUMNS=100 eselect --colour=no ${eselect_args[@]} 2> /dev/null)" 15 | 16 | while IFS="" read -r helpdesc ; do 17 | case "$helpdesc" in 18 | ("Built-in modules:"|"Standard actions:")) 19 | mod_cur="mod_std" 20 | ;; 21 | ("Extra modules:"|"Extra actions:")) 22 | mod_cur="mod_extra" 23 | ;; 24 | esac 25 | 26 | if [[ "$helpdesc" =~ '^ [A-Za-z]' ]] ; then 27 | echo "$helpdesc" | read mod descr 28 | descr="$(echo "$descr" | sed -r -e 's/.*\s\s\s+//')" 29 | set -A $mod_cur ${(P)mod_cur} ${mod}:${(q)descr} 30 | fi 31 | done <<< "$eselect_descr" 32 | 33 | if [[ -z "${eselect_args[@]}" ]] ; then 34 | etype="modules" 35 | else 36 | etype="actions" 37 | fi 38 | 39 | if [[ -z "${mod_extra}" && -z "${mod_std}" ]] ; then 40 | _nothing 41 | else 42 | _describe -t eselect_extra -V "eselect extra $etype" mod_extra 43 | _describe -t eselect_standard -V "eselect standard $etype" mod_std 44 | fi 45 | } 46 | 47 | _eselect_parse_action_list() { 48 | local idx item tag 49 | local -a _sel_items 50 | local -a _unsel_items 51 | 52 | while read idx item tag descr ; do 53 | if [[ "$idx" == '[' && "$item" == ']' ]] ; then 54 | continue 55 | fi 56 | if [[ ${tag} =~ '^[*@#]$' ]] ; then 57 | _sel_items+=($item) 58 | else 59 | _unsel_items+=($item) 60 | fi 61 | done <<< $(LANG=C COLUMNS=100 eselect --colour=no $1 list 2> /dev/null | tail -n +2) 62 | 63 | set -A $2 ${_sel_items[@]} 64 | set -A $3 ${_unsel_items[@]} 65 | 66 | } 67 | 68 | _eselect_module_action() { 69 | if (( $+functions[_eselect_${1}_action] )) ; then 70 | _eselect_${1}_action 71 | else 72 | _eselect_parse_generic ${1} 73 | fi 74 | } 75 | 76 | _eselect_complete_action() { 77 | local actionname=$(_eselect_get_module) 78 | if (( $+functions[_eselect_complete_${actionname}_action] )) ; then 79 | _eselect_complete_${actionname}_action 80 | return 0 81 | fi 82 | 83 | if (( $NORMARG + $(_eselect_action_index) == $CURRENT )) ; then 84 | _eselect_complete_action_generic ${actionname} 85 | return 0 86 | fi 87 | 88 | _nothing 89 | } 90 | 91 | _eselect_get_module() { 92 | if [[ $service == "eselect" ]] ; then 93 | echo $line[1] 94 | else 95 | echo ${service%-config} 96 | fi 97 | } 98 | 99 | _eselect_action_index() { 100 | if [[ $service == "eselect" ]] ; then 101 | echo 2 102 | else 103 | echo 1 104 | fi 105 | } 106 | _eselect_get_action () { 107 | echo ${line[$(_eselect_action_index)]} 108 | } 109 | 110 | _eselect_action() { 111 | _eselect_module_action $(_eselect_get_module) 112 | } 113 | 114 | _eselect_module() { 115 | _eselect_parse_generic 116 | } 117 | 118 | (( $+function[_eselect_complete_action_generic] )) || _eselect_complete_action_generic() { 119 | local -a sel_items 120 | local -a unsel_items 121 | 122 | case "$(_eselect_get_action)" in 123 | ("set"|"enable")) 124 | _eselect_parse_action_list $1 sel_items unsel_items 125 | if (( $#unsel_items + $#sel_items > 0 )) ; then 126 | _describe -t eselect_sel -V 'eselect items' unsel_items 127 | if (( $#unsel_items + $#sel_items < 10 )) ; then 128 | _describe -t eselect_unsel -V 'eselect already selected items' sel_items 129 | fi 130 | return 0 131 | fi 132 | ;; 133 | ("remove"|"disable")) 134 | _eselect_parse_action_list $1 sel_items unsel_items 135 | if [[ -n "${sel_items[@]}" ]] ; then 136 | _describe -V 'eselect items' sel_items 137 | return 0 138 | fi 139 | ;; 140 | esac 141 | 142 | _nothing 143 | } 144 | 145 | # custom completions: 146 | (( $+functions[_eselect_complete_news_action] )) || _eselect_complete_news_action() { 147 | local -a items 148 | 149 | case "$(_eselect_get_action)" in 150 | ("read"|"unread")) 151 | local idx descr 152 | while read idx descr ; do 153 | idx=${idx#'['} 154 | idx=${idx%']'} 155 | items=(${idx}:${(q)descr} ${items[@]}) 156 | done <<< $(eselect --colour=no news list 2> /dev/null | tail -n +2) 157 | items+=('all:Read all news items') 158 | if [[ $(_eselect_get_action) == "read" ]] ; then 159 | items+=('new:Read unread news items (default)') 160 | fi 161 | 162 | if [[ -n "${items[@]}" ]] ; then 163 | _describe -V 'eselect news' items 164 | return 0 165 | fi 166 | ;; 167 | esac 168 | 169 | _nothing 170 | } 171 | 172 | (( $+functions[_eselect_complete_kernel_action] )) || _eselect_complete_kernel_action() { 173 | local -a items 174 | 175 | if (( $NORMARG + $(_eselect_action_index) == $CURRENT )) ; then 176 | case "$(_eselect_get_action)" in 177 | "set") 178 | for k in ${(@f)$(eselect --colour=no --brief kernel list)} ; do 179 | items+=${k#linux-} 180 | done 181 | local -a expl=(-P linux-) 182 | compadd -V 'eselect kernel' -P linux- ${items[@]} 183 | return 0 184 | ;; 185 | esac 186 | fi 187 | 188 | _nothing 189 | } 190 | 191 | (( $+functions[_eselect_complete_profile_action] )) || _eselect_complete_profile_action() { 192 | if (( $NORMARG + $(_eselect_action_index) == $CURRENT )) ; then 193 | case "$(_eselect_get_action)" in 194 | "set") 195 | _values 'eselect profiles' $(eselect --colour=no --brief profile list) 196 | return 0 197 | ;; 198 | esac 199 | fi 200 | 201 | _nothing 202 | } 203 | 204 | (( $+functions[_eselect_complete_timezone_action] )) || _eselect_complete_timezone_action() { 205 | if (( $NORMARG + $(_eselect_action_index) == $CURRENT )) ; then 206 | case "$(_eselect_get_action)" in 207 | "set") 208 | _multi_parts / "($(eselect --colour=no --brief timezone list))" 209 | return 0 210 | ;; 211 | esac 212 | fi 213 | 214 | _nothing 215 | } 216 | 217 | (( $+functions[_eselect_complete_php_action] )) || _eselect_complete_php_action() { 218 | if (( $NORMARG + $(_eselect_action_index) == $CURRENT )) ; then 219 | case "$(_eselect_get_action)" in 220 | ("list"|"set"|"show"|"update")) 221 | _values 'eselect php modules' $(eselect --colour=no --brief php list-modules) 222 | return 0 223 | ;; 224 | esac 225 | elif (( $NORMARG + $(_eselect_action_index) + 1 == $CURRENT )) ; then 226 | case "$words[$CURRENT-2]" in 227 | "set") 228 | local targets=($(eselect --colour=no --brief php list "$words[$CURRENT-1]" 2> /dev/null)) 229 | if [ -n "$targets" ]; then 230 | _values 'eselect php modules' ${targets[@]} 231 | return 0 232 | fi 233 | ;; 234 | esac 235 | fi 236 | 237 | _nothing 238 | } 239 | 240 | (( $+functions[_eselect_complete_rc_action] )) || _eselect_complete_rc_action() { 241 | if (( $NORMARG + $(_eselect_action_index) == $CURRENT )) ; then 242 | case "$(_eselect_get_action)" in 243 | ("list"|"show")) 244 | _values 'runlevels' $(command ls --color=never ${EPREFIX}/etc/runlevels) 245 | return 0 246 | ;; 247 | ("add"|"delete"|"pause"|"reload"|"restart"|"start"|"stop")) 248 | _values 'scripts' $(rc-service -l) 249 | return 0 250 | ;; 251 | esac 252 | elif (( $NORMARG + $(_eselect_action_index) + 1 == $CURRENT )) ; then 253 | case "$words[$CURRENT-2]" in 254 | ("add"|"delete")) 255 | _values 'runlevels' $(command ls --color=never ${EPREFIX}/etc/runlevels) 256 | return 0 257 | ;; 258 | esac 259 | fi 260 | 261 | _nothing 262 | } 263 | 264 | 265 | (( $+functions[_eselect_complete_repository_action] )) || _eselect_complete_repository_action() { 266 | local -a opts 267 | 268 | case "$(_eselect_get_action)" in 269 | ("disable"|"remove")) 270 | opts=('-f:Force potentially dangerous removals') 271 | ;; 272 | "list") 273 | opts=('-i:Only list installed') 274 | ;; 275 | esac 276 | 277 | _describe -o 'options' opts 278 | _eselect_complete_action_generic repository 279 | } 280 | 281 | eselect_comp() { 282 | integer NORMARG 283 | 284 | case "$service" in 285 | eselect) 286 | _arguments -A '-*' -n \ 287 | '--brief[Make output shorter]' \ 288 | '(--colour --color)'--colo{,u}r='[Enable or disable colour output]:colour:(yes no)' \ 289 | '1:eselect_module:_eselect_module' \ 290 | '2:eselect_action:_eselect_action' \ 291 | '*:eselect_complete_action:_eselect_complete_action' 292 | ;; 293 | *-config) 294 | _arguments -n \ 295 | "1:action:_eselect_action" \ 296 | '*:eselect_complete_action:_eselect_complete_action' 297 | ;; 298 | esac 299 | } 300 | 301 | eselect_comp "$@" 302 | 303 | # vim: set et sw=2 ts=2 ft=zsh: 304 | -------------------------------------------------------------------------------- /src/_g-cpan: -------------------------------------------------------------------------------- 1 | #compdef g-cpan 2 | # g-cpan-0.16.6 3 | 4 | local arguments 5 | 6 | arguments=( 7 | '(- :)'{--help,-h}'[Show help]' 8 | {'(--generate)-g','(-g)--generate'}'[Generate ebuilds only (Requires working overlays)]' 9 | {'(--install)-i','(-i)--install'}'[Try to generate ebuild for the given module name and, if successful, emerge it. Important : installation requires exact CPAN Module Name.]' 10 | {'(--list)-l','(-l)--list'}'[This command generates a list of the Perl modules and ebuilds handled by g-cpan.]' 11 | {'(--log)-L','(-L)--log'}'[Log the output of g-cpan]' 12 | {'(--search)-s','(-s)--search'}'[Search CPAN for the given expression (similar to the "m /EXPR/" from the CPAN Shell). Searches are case insensitive.]' 13 | {'(--upgrade)-u','(-u)--upgrade'}'[Try to list and upgrade all Perl modules managed by g-cpan. It generate up-to-date ebuilds, then emerge then.]' 14 | {'(--verbose)-v','(-v)--verbose'}'[Enable (some) verbose output.]' 15 | "--cpan_reload[Reload the CPAN index]" 16 | {'(--ask)-a','(-a)--ask'}'[Ask before installing]' 17 | {'(--buildpkg)-b','(-b)--buildpkg'}'[Tells emerge to build binary packages for all ebuilds processed in addition to actually merging the packages.]' 18 | {'(--buildpkgonly)-B','(-B)--buildpkgonly'}'[Creates binary packages for all ebuilds processed without actually mering the packages.]' 19 | {'(--pretend)-p','(-p)--pretend'}"[Pretend (show actions, but don't emerge). This still generates new ebuilds.]" 20 | '*:modules:' 21 | ) 22 | 23 | _arguments $arguments 24 | 25 | # vim: set et sw=2 ts=2 ft=zsh: 26 | -------------------------------------------------------------------------------- /src/_gcc-config: -------------------------------------------------------------------------------- 1 | #compdef gcc-config 2 | # gcc-config-1.8 3 | 4 | local arguments 5 | 6 | arguments=( 7 | {'(--nocolor)-C','(-C)--nocolor'}'[disable colored output]' 8 | '(- :)'{--use-old,-O}'[use the old profile if one was selected]' 9 | {'(--force)-f','(-f)--force'}'[make sure all config files are regenerated]' 10 | '(- :)'{--get-current-profile,-c}'[print current used gcc profile]' 11 | '(- :)'{--list-profiles,-l}'[print a list of available profiles]' 12 | {'(--split-profile)-S','(-S)--split-profile'}'[split profiles into their components]' 13 | '(- :)'{--print-environ,-E}'[print environment of the given/current profile]:profiles:_gcc_profiles' 14 | '(- :)'{--get-bin-path,-B}'[print binary path of given/current profile]:profiles:_gcc_profiles' 15 | '(- :)'{--get-lib-path,-L}'[print library path of given/current profile]:profiles:_gcc_profiles' 16 | '(- :)'{--help,-h}'[show help]' 17 | '(- :):profiles:_gcc_profiles' 18 | ) 19 | 20 | _gcc_profiles(){ 21 | local profiles 22 | profiles=(${(f)"$(_call_program gcc-installed RC_NOCOLOR=yes gcc-config --list-profiles)"}) 23 | profiles=${${profiles/\[([^]]*)\]/}/\*} 24 | _tags profiles && { compadd "$@" -k profiles || compadd "$@" ${(kv)=profiles} } 25 | } 26 | 27 | _arguments $arguments 28 | 29 | # vim: set et sw=2 ts=2 ft=zsh: 30 | -------------------------------------------------------------------------------- /src/_genlop: -------------------------------------------------------------------------------- 1 | #compdef genlop 2 | 3 | #genlop 0.30.8 4 | 5 | _genlop () { 6 | local prev1="$words[CURRENT-1]" prev2="$words[CURRENT-2]" days months arg single state lstate 7 | days=(monday tuesday wednesday thursday friday saturday sunday) 8 | months=(january february march april may june july august september october november december) 9 | arg=( --current -c --time -t --gmt -g --info -i --file -f --rsync -r --unmerge -u --date --search -s --list -l ) 10 | single=( --current -c --pretend -p --help -h --version -v ) 11 | 12 | [[ ${prev2} == (1st|2nd|3rd|4th|5th) ]] && 13 | compadd $months && return 0 14 | [[ ${prev1} == ([2-9]|[1-9][0-9]*) && ${prev2} != \ 15 | (january|february|march|april|may|june|july|august|september|october|november|december) ]] && 16 | _values '' 'days ago' 'months ago' 'years ago' 'weeks ago' && return 0 17 | [[ ${prev1} == (1) && ${prev2} != \ 18 | (january|february|march|april|may|june|july|august|september|october|november|december) ]] && 19 | _values '' 'day ago' 'month ago' 'year ago' 'week ago' && return 0 20 | 21 | case "$prev1" in 22 | last) 23 | _values '' month week 24 | compadd $days && return 0 25 | ;; 26 | 1st|2nd|3rd|4th|5th) 27 | compadd $days && return 0 28 | ;; 29 | january|february|march|april|may|june|july|august|september|october|november|december) 30 | compadd {1..31} && return 0 31 | ;; 32 | --date) 33 | _message 'enter number for more options or use mm/dd/yyyy format' 34 | _values '' last yesterday 1st 2nd 3rd 4th 5th 35 | _alternative '*:*:_days' '*:*:_months' && return 0 36 | ;; 37 | --file|-f) 38 | _arguments '*:logfile:_files' && return 0 39 | ;; 40 | *) 41 | _arguments \ 42 | "($single $arg *)"{--current,-c}"[display the current merge in action]" \ 43 | "($single)*--date[specify date of event]:date:->date" \ 44 | "($single)*-f[specify the logfile to use]:logfile:_files" \ 45 | "($single --gmt -g)"{--gmt,-g}"[display time in GMT/UTC format (default is local time)]" \ 46 | "($single $arg *)"{--help,-h}"[display help information]" \ 47 | "($single --info -i --list -l)"{--info,-i}"[print brief summary about installed ebuild]" \ 48 | "($single --search -s --info -i --list -l *)"{--list,-l}"[list merge history]" \ 49 | "(--nocolor -n)"{--nocolor,-n}"[disable colored output]" \ 50 | "($single $arg *)"{--pretend,-p}"[estimate build time of a piped emerge -p]" \ 51 | "($single --search -s --info -i --time -t --unmerge -u --rsync -r *)"{--rsync,-r}"[display rsync history]" \ 52 | "($single --rsync -r --search -s --list -l *)"{--search,-s}"[select ebuilds matching the provided regular expression]:pattern:" \ 53 | "($single --time -t)"{--time,-t}"[display merge time]" \ 54 | "($single --rsync -r --unmerge -u)"{--unmerge,-u}"[display when packages have been unmerged]" \ 55 | "($single $arg *)"{--version,-v}"[display version information]" \ 56 | "($single)*:package:_gentoo_packages available" 57 | ;; 58 | esac 59 | 60 | while [[ -n "$state" ]]; do 61 | lstate=$state 62 | state='' 63 | case "$lstate" in 64 | date) 65 | _message 'enter number for more options or use mm/dd/yyyy format' 66 | _values '' last yesterday 1st 2nd 3rd 4th 5th 67 | _alternative ':*:_days' ':*:_months' && return 0 68 | ;; 69 | esac 70 | done 71 | } 72 | 73 | _days() { 74 | local m="monday" t="tuesday" w="wednesday" T="thursday" f="friday" s="saturday" S="sunday" 75 | local day=$(date +%u) 76 | if [[ ${day} == 1 ]] then compadd $m 77 | elif [[ ${day} == 2 ]] then compadd $m $t 78 | elif [[ ${day} == 3 ]] then compadd $m $t $w 79 | elif [[ ${day} == 4 ]] then compadd $m $t $w $T 80 | elif [[ ${day} == 5 ]] then compadd $m $t $w $T $f 81 | elif [[ ${day} == 6 ]] then compadd $m $t $w $T $f $s 82 | elif [[ ${day} == 7 ]] then compadd $m $t $w $T $f $s $S 83 | fi 84 | } 85 | _months() { 86 | 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" 87 | local month=$(date +%m) 88 | if [[ ${month} == 01 ]] then compadd $j 89 | elif [[ ${month} == 02 ]] then compadd $j $f 90 | elif [[ ${month} == 03 ]] then compadd $j $f $m 91 | elif [[ ${month} == 04 ]] then compadd $j $f $m $a 92 | elif [[ ${month} == 05 ]] then compadd $j $f $m $a $M 93 | elif [[ ${month} == 06 ]] then compadd $j $f $m $a $M $ju 94 | elif [[ ${month} == 07 ]] then compadd $j $f $m $a $M $ju $J 95 | elif [[ ${month} == 08 ]] then compadd $j $f $m $a $M $ju $J $A 96 | elif [[ ${month} == 09 ]] then compadd $j $f $m $a $M $ju $J $A $s 97 | elif [[ ${month} == 10 ]] then compadd $j $f $m $a $M $ju $J $A $s $o 98 | elif [[ ${month} == 11 ]] then compadd $j $f $m $a $M $ju $J $A $s $o $n 99 | elif [[ ${month} == 12 ]] then compadd $j $f $m $a $M $ju $J $A $s $o $n $d 100 | fi 101 | } 102 | 103 | # vim: set et sw=2 ts=2 ft=zsh: 104 | -------------------------------------------------------------------------------- /src/_gentoo_arches: -------------------------------------------------------------------------------- 1 | #autoload 2 | 3 | local arches arch allarches 4 | 5 | arches=(${(f)"$(<$(_gentoo_repos -m)/profiles/arch.list)"}) 6 | for arch in $arches; do 7 | [[ $arch =~ '^[^#]' ]] && allarches+=( $arch ) 8 | done 9 | 10 | echo "${allarches[@]}" 11 | 12 | # vim: ft=zsh sw=2 ts=2 et 13 | -------------------------------------------------------------------------------- /src/_gentoo_packages: -------------------------------------------------------------------------------- 1 | #autoload 2 | 3 | setopt extendedglob bareglobqual 4 | #Description: 5 | # functions for gentoo packages 6 | # inspired by _deb_packages 7 | #Usage: _gentoo_packages installed|available|installed_versions|available_versions|binary|category|useflag 8 | 9 | _parsesetsconf() { 10 | [[ -d ${1} ]] || continue 11 | 12 | local v f places sections setsconf insection section arr 13 | 14 | if [[ -d ${1}/sets ]]; then 15 | setsconf=(${1}/sets/*.conf(N)) 16 | [[ (($#setsconf > 0)) ]] && places=(${setsconf}) 17 | elif [[ -f ${1}/sets.conf ]]; then 18 | places=(${1}/sets.conf) 19 | fi 20 | 21 | for f in ${(@)places}; do 22 | if [[ -r ${f} ]]; then 23 | insection=0 24 | declare -A arr 25 | IFS='= ' 26 | while read -r name value; do 27 | [[ -z ${name} || ${name} == '#'* ]] && continue 28 | 29 | if [[ (${name} == '['*']') && (-z ${value}) ]]; then 30 | value=${name//(\]|\[)} 31 | name="section" 32 | fi 33 | arr[${name}]=${value} 34 | 35 | if [[ ${insection} == 1 && ${name} == "section" ]]; then 36 | [[ ${2} == "sets" ]] && [[ ! ${value} =~ "sets" ]] && sections+=(${value}) 37 | insection=0 38 | elif [[ ${name} == "section" ]]; then 39 | [[ ${value} =~ "${1:t} sets" ]] && insection=1 40 | [[ ${2} == "sets" ]] && [[ ! ${value} =~ "sets" ]] && sections+=(${value}) 41 | elif [[ ${insection} == 1 ]]; then 42 | [[ ${2} == "sets" ]] && continue 43 | if [[ ${name} == "directory" ]]; then 44 | v=${value} 45 | fi 46 | fi 47 | continue 48 | done < ${f} 49 | fi 50 | done 51 | 52 | if [[ ${2} == "sets" ]]; then 53 | [[ ((${#sections} > 0)) ]] && echo ${(@)sections} 54 | else 55 | [[ ((${#v} > 0)) ]] && echo ${v:t} 56 | fi 57 | } 58 | 59 | _gentoo_packages_update_installed_sets() { 60 | local sets 61 | sets=($(<${EPREFIX}/var/lib/portage/world_sets)) 62 | if [[ ((${#sets} > 0)) ]]; then 63 | _wanted installed_sets expl 'installed set' compadd "$@" "${(o@)^sets}" 64 | fi 65 | } 66 | 67 | _gentoo_packages_update_available_sets() { 68 | local dirs dir sets_dir set sets sets_path sets_files 69 | 70 | dirs=($(_gentoo_repos -o) ${EPREFIX}/etc/portage ${EPREFIX}/usr/share/portage/config) 71 | 72 | for dir in ${(@)dirs}; do 73 | if [[ -d ${dir} ]]; then 74 | sets_dir="$(_parsesetsconf ${dir})" 75 | [[ ! -z "${sets_dir}" ]] && sets_path="${dir}/${sets_dir}" || sets_path="${dir}/sets" 76 | if [[ -d "${sets_path}" ]]; then 77 | sets_files=(${sets_path}/*~*.conf(N)) 78 | for set in ${sets_files[@]}; do 79 | sets+=(${set}(:t)) 80 | done 81 | sets+=($(_parsesetsconf ${dir} sets)) 82 | fi 83 | fi 84 | done 85 | if [[ ((${#sets} > 0)) ]]; then 86 | _wanted available_sets expl 'available set' compadd "$@" "@${(o@)^sets}" 87 | fi 88 | } 89 | 90 | # Completion function to show useflags. 91 | _gentoo_packages_update_useflag(){ 92 | local flags repo 93 | 94 | for repo in $(_gentoo_repos); do 95 | [[ -r ${repo}/profiles/use.desc ]] && 96 | flags+=(${${(M)${(f)"$(<${repo}/profiles/use.desc)"}:#* - *}%% - *}) 97 | [[ -r ${repo}/profiles/use.local.desc ]] && 98 | flags+=(${${${(M)${(f)"$(<${repo}/profiles/use.local.desc)"}#* - *}%% - *}#*:}) 99 | done 100 | 101 | compadd $flags 102 | } 103 | 104 | _gentoo_packages_update_active_useflag(){ 105 | local flags USE 106 | var=USE 107 | [[ -z ${(P)var} && -r ${EPREFIX}/etc/portage/make.conf ]] && 108 | local $var="$(. ${EPREFIX}/etc/portage/make.conf 2>/dev/null; echo ${(P)var})" 109 | [[ -z ${(P)var} && -r ${EPREFIX}/etc/make.conf ]] && 110 | local $var="$(. ${EPREFIX}/etc/make.conf 2>/dev/null; echo ${(P)var})" 111 | flags=(${${${=USE}%-*}%\\*}) 112 | compadd $flags 113 | } 114 | 115 | _gentoo_packages_update_category(){ 116 | local repos category 117 | 118 | repos=($(_gentoo_repos)) 119 | category=( $repos/*-*(/:t) ) 120 | _wanted cat_packages expl 'category' compadd "$@" $category 121 | } 122 | 123 | _gentoo_packages_update_installed(){ 124 | local installed_dir installed_portage installed_pkgname installed_list 125 | installed_dir="${EPREFIX}/var/db/pkg" 126 | installed_portage=($installed_dir/*-*/*) 127 | 128 | installed_pkgname=(${${installed_portage:t}%%-[0-9]*}) 129 | _wanted packages expl 'package' compadd "$@" ${installed_pkgname} 130 | 131 | installed_list=( ${${installed_portage#$installed_dir/}%%-[0-9]*} ) 132 | _wanted cat_packages expl 'category/package' _multi_parts "$@" / installed_list 133 | } 134 | 135 | _gentoo_packages_update_installed_versions(){ 136 | local installed_list installed_portage 137 | 138 | installed_portage=(${EPREFIX}/var/db/pkg/*-*/*) 139 | _wanted packages expl 'package' compadd "$@" ${installed_portage:t} 140 | 141 | installed_list=(${installed_portage##*/pkg/}) 142 | _wanted cat_packages expl 'category/package' _multi_parts "$@" / installed_list 143 | } 144 | 145 | _gentoo_packages_update_available_pkgnames_only(){ 146 | local repos packages 147 | 148 | repos=($(_gentoo_repos)) 149 | 150 | packages=($repos/*-*/*(:t)) 151 | _wanted packages expl 'package' compadd - "${(@)packages}" 152 | } 153 | 154 | _gentoo_packages_update_available(){ 155 | local repos category packages pkg expl 156 | 157 | repos=($(_gentoo_repos)) 158 | category=($repos/*-*(/:t)) 159 | 160 | packages=($repos/*-*/*(:t)) 161 | _wanted packages expl 'package' compadd - "${(@)packages}" 162 | 163 | # Complete cat/pkg. _multi_parts is much to slow for such a large task, 164 | # _sep_parts removes the dash from gnome-, and _path_files wants to 165 | # complete cat/pkg/files (if "files" is ignored with -F, miscfiles, etc... 166 | # don't get completed). 167 | if [[ $PREFIX != */* ]]; then 168 | _wanted cat_packages expl 'category/package' compadd -S '/' $category 169 | else 170 | compset -P '*/' 171 | pkg=($repos/$IPREFIX/*(:t)) 172 | _wanted cat_packages expl 'category/package' compadd $pkg 173 | fi 174 | } 175 | 176 | _gentoo_packages_update_available_versions(){ 177 | local main_repo overlays overlay_ebuilds gentoo_ebuilds repos category pkg 178 | 179 | main_repo=$(_gentoo_repos -m) 180 | overlays=$(_gentoo_repos -o) 181 | 182 | repos=($main_repo $=overlays) 183 | category=($repos/*-*(/:t)) 184 | typeset -U category 185 | 186 | if [[ $#PREFIX -ge 1 && -z $words[(r)(--inject|-i)] ]]; then 187 | overlay_ebuilds=($=overlays/*-*/${PREFIX%%-[0-9]#*}*/*.ebuild(:t:r) ) 188 | gentoo_ebuilds=($main_repo/metadata/cache/*-*/${PREFIX%%-[0-9]#*}*(:t)) 189 | _wanted packages expl 'package' compadd $gentoo_ebuilds $overlay_ebuilds 190 | fi 191 | pkg=( $repos/${PREFIX%%/*}/*/*.ebuild(:t:r) ) 192 | _wanted cat_packages expl 'category/package' _sep_parts category / pkg 193 | } 194 | 195 | #Function to show tbz2 files available 196 | _gentoo_packages_update_binary() { 197 | local PKGDIR 198 | 199 | [[ -z $PKGDIR && -r ${EPREFIX}/etc/portage/make.conf ]] && 200 | PKGDIR="$(. ${EPREFIX}/etc/portage/make.conf 2>/dev/null; echo $PKGDIR)" 201 | [[ -z $PKGDIR && -r ${EPREFIX}/etc/make.conf ]] && 202 | PKGDIR="$(. ${EPREFIX}/etc/make.conf 2>/dev/null; echo $PKGDIR)" 203 | [[ -z $PKGDIR && -r ${EPREFIX}/usr/share/portage/config/make.globals ]] && 204 | PKGDIR="$(. ${EPREFIX}/usr/share/portage/config/make.globals 2>/dev/null; echo $PKGDIR)" 205 | 206 | # this doesn't take care of ${PORTAGE_BINHOST}. If Gentoo official 207 | # binary mirror will be available we should rewrite it accordingly. 208 | _path_files -g \*.tbz2 -W "$PKGDIR/All" 209 | } 210 | 211 | _gentoo_packages () { 212 | local command="$argv[$#]" expl cachevar pkgset update_policy 213 | 214 | zstyle -s ":completion:*:*:$service:*" cache-policy update_policy 215 | if [[ -z "$update_policy" ]]; then 216 | zstyle ":completion:*:*:$service:*" cache-policy _gentoo_cache_policy 217 | fi 218 | [[ "$command" == (installed(_versions|_sets|)|available(_versions|_sets|_pkgnames_only|)|binary|category|(active_|)useflag) ]] || { 219 | _message "unknown command: $command" 220 | return 221 | } 222 | [[ "$pkgset" == (installed(_versions|_sets|)|available(_versions|_sets|_pkgnames_only|)|binary|category|(active_|)useflag) ]] || { 223 | pkgset="$command" 224 | } 225 | expl=("${(@)argv[1,-2]}") 226 | _gentoo_packages_update_$pkgset 227 | } 228 | 229 | _gentoo_cache_policy () { 230 | local oldp 231 | 232 | # rebuild if cache is more than a week old 233 | oldp=( "$1"(mw+1) ) 234 | (( $#oldp )) && return 0 235 | } 236 | 237 | _gentoo_packages "$@" 238 | 239 | # vim: set et sw=2 ts=2 ft=zsh: 240 | -------------------------------------------------------------------------------- /src/_gentoo_repos: -------------------------------------------------------------------------------- 1 | #autoload 2 | 3 | # Usage: 4 | # _gentoo_repos -> returns the list of all repos 5 | # _gentoo_repos -m -> returns the main repo 6 | # _gentoo_repos -o -> returns the list of non-main repos 7 | 8 | _gentoo_repos() { 9 | local main_repo main_repo_path overlay overlay_paths result 10 | 11 | overlay_paths=(); 12 | result=(); 13 | 14 | if [[ -e ${EPREFIX}/usr/share/portage/config/repos.conf || -e ${EPREFIX}/etc/portage/repos.conf ]]; then 15 | main_repo=$(_gentoo_repos_conf DEFAULT main-repo) 16 | main_repo_path=$(_gentoo_repos_conf ${main_repo} location) 17 | 18 | for overlay in $(_gentoo_repos_conf -l); do 19 | overlay_paths+=($(_gentoo_repos_conf ${overlay} location)) 20 | done 21 | 22 | source ${EPREFIX}/etc/make.conf 2>/dev/null 23 | source ${EPREFIX}/etc/portage/make.conf 2>/dev/null 24 | 25 | overlay_paths+=(${(@)PORTDIR_OVERLAY}) 26 | else 27 | source ${EPREFIX}/usr/share/portage/config/make.globals 2>/dev/null 28 | source ${EPREFIX}/etc/make.conf 2>/dev/null 29 | source ${EPREFIX}/etc/portage/make.conf 2>/dev/null 30 | 31 | main_repo_path="${PORTDIR}" 32 | overlay_paths=(${(@)PORTDIR_OVERLAY}) 33 | fi 34 | 35 | if [[ $1 == "-m" ]]; then 36 | result+=(${main_repo_path}) 37 | elif [[ $1 == "-o" ]]; then 38 | result+=(${(@)overlay_paths}) 39 | else 40 | result+=(${main_repo_path} ${(@)overlay_paths}) 41 | fi 42 | 43 | echo ${(u)result} 44 | } 45 | 46 | _gentoo_repos "$@" 47 | 48 | # vim: set et sw=2 ts=2 ft=zsh: 49 | -------------------------------------------------------------------------------- /src/_gentoo_repos_conf: -------------------------------------------------------------------------------- 1 | #autoload 2 | 3 | # Usage: 4 | # _gentoo_repos_conf -l -> returns the list of all repos names 5 | # _gentoo_repos_conf REPO ATTRIBUTE -> returns the VALUE associated 6 | # with the ATTRIBUTE of the REPO 7 | 8 | _gentoo_repos_conf() { 9 | local v file insection section arr secname 10 | 11 | secname=(); 12 | 13 | 14 | for file in ${EPREFIX}/usr/share/portage/config/repos.conf \ 15 | ${EPREFIX}/etc/portage/repos.conf \ 16 | ${EPREFIX}/etc/portage/repos.conf/*.conf; do 17 | 18 | [[ -f ${file} ]] || continue 19 | insection=0 20 | declare -A arr 21 | IFS='= ' 22 | 23 | while read -r name value; do 24 | [[ -z ${name} || ${name} == '#'* ]] && continue 25 | 26 | if [[ (${name} == '['*']') && (-z ${value}) ]]; then 27 | value=${name//(\]|\[)} 28 | name="section" 29 | fi 30 | arr[${name}]=${value} 31 | 32 | if [[ ${insection} == 1 && ${name} == "section" ]]; then 33 | break 34 | elif [[ ${name} == "section" ]]; then 35 | [[ ${value} == ${1} ]] && insection=1 36 | secname+=(${value}) 37 | elif [[ ${insection} == 1 ]]; then 38 | if [[ ${name} == ${2} ]]; then 39 | v=${value} 40 | fi 41 | fi 42 | continue 43 | done < ${file} 44 | done 45 | 46 | if [[ ${1} == "-l" ]]; then 47 | echo "${(@u)secname}" 48 | else 49 | echo "${v}" 50 | fi 51 | } 52 | 53 | _gentoo_repos_conf "$@" 54 | 55 | # vim: set et sw=2 ts=2 ft=zsh: 56 | -------------------------------------------------------------------------------- /src/_gentoolkit: -------------------------------------------------------------------------------- 1 | #compdef equery euse eclean eclean-dist eclean-pkg epkginfo eshowkw genpkgindex glsa-check revdep-rebuild 2 | 3 | # XXX: shouldn't this go to _gentoo_package? 4 | _packages () { 5 | if compset -P '(\\|)(>=|<=|<|>|=)'; then 6 | _gentoo_packages ${*/(#m)(installed|available)/${MATCH}_versions} 7 | else 8 | _gentoo_packages $* 9 | fi 10 | } 11 | 12 | _euse () { 13 | local state tmp start_args suboptions_args 14 | 15 | start_args=( 16 | {'(--help)-h','(-h)--help'}'[show help]' 17 | {'(--version)-v','(-v)--version'}'[show version]' 18 | {'(--info)-i','(-i)--info'}'[show descriptions for the given useflags]' 19 | {'(--info-installed)-I','(-I)--info-installed'}'[show descriptions for the given useflags and their current impact on the installed system]' 20 | {'(--active)-a','(-a)--active'}'[show currently active useflags and their origin]' 21 | {'(--enable)-E','(-E)--enable'}'[enable the given useflags]' 22 | {'(--disable)-D','(-D)--disable'}'[disable the given useflags]' 23 | {'(--remove)-R','(-R)--remove'}'[remove all references to the given flags from make.conf and package.use to revert to default settings]' 24 | {'(--prune)-P','(-P)--prune'}'[alias for --remove]' 25 | {'(--package)-p','(-p)--package'}'[used with -E, -D, and -R to apply to a specific package only]' 26 | ) 27 | 28 | suboptions_args=( 29 | {'(--global)-g','(-g)--global'}'[show only global use flags]' 30 | {'(--local)-l','(-l)--local'}'[show only local use flags]' 31 | ) 32 | 33 | if (( CURRENT == 2 )); then 34 | _arguments -s $start_args 35 | elif (( CURRENT == 3 )); then 36 | case "$words[2]" in 37 | -i|--info|-a|--active) 38 | _arguments -s $suboptions_args \ 39 | '*:useflags:_gentoo_packages useflag' && ret=0 40 | ;; 41 | -E|--enable) 42 | _arguments \ 43 | '*:useflags:_gentoo_packages useflag' && ret=0 44 | ;; 45 | -D|--disable) 46 | _arguments \ 47 | '*:active useflags:_gentoo_packages active_useflag' && ret=0 48 | esac 49 | else 50 | _arguments \ 51 | '*:useflag:_gentoo_packages useflag' && ret=0 52 | fi 53 | } 54 | 55 | _equery () { 56 | # Based off of X/_xauth. 57 | local state context line expl ret=1 58 | local tmp cmd start_args common_args 59 | 60 | start_args=( 61 | {'(--nocolor)-C','(-C)--nocolor'}'[turns off colors]' 62 | {'(--no-pipe)-N','(-N)--no-pipe'}'[turn off pipe detection]' 63 | {'(--quiet)-q','(-q)--quiet'}'[minimal output]' 64 | {'(--help)-h','(-h)--help'}'[show help]' 65 | {'(--version)-V','(-V)--version'}'[show version]' 66 | ) 67 | 68 | common_args=( 69 | '(-I --exclude-installed)'{-I,--exclude-installed}'[do not search installed packages]' 70 | '(-p --portage-tree)'{-p,--portage-tree}'[also search in portage tree]' 71 | '(-o --overlay-tree)'{-o,--overlay-tree}'[also search in overlay tree]' 72 | ) 73 | 74 | _arguments -s $start_args \ 75 | '*::command:->command' && ret=0 76 | 77 | while [[ -n "$state" ]]; do 78 | tmp="$state" 79 | state= 80 | case "$tmp" in 81 | command) 82 | if (( CURRENT == 1 )); then 83 | state=subcommands 84 | else 85 | cmd="$words[1]" 86 | curcontext="${curcontext%:*:*}:equery-${cmd}:" 87 | case "$cmd" in 88 | belongs|b) 89 | _arguments \ 90 | '(-e --early-out)'{-e,--early-out}'[stop when first match found]' \ 91 | '(-f --full-regex)'{-f,--full-regex}'[supplied query is a regex]:pattern:' \ 92 | '(-n --name-only)'{-n,--name-only}"[don't print the version]" \ 93 | '*:file:_files' && ret=0 94 | ;; 95 | changes|c) 96 | _arguments \ 97 | '(-l --latest)'{-l,--latest}'[only display latest ChangeLog entry]' \ 98 | '(-f --full)'{-f,--full}'[display full ChangeLog entry]' \ 99 | '--limit[limit the number of entries displayed (with --full)]:number:' \ 100 | '--from[which version to display from]' \ 101 | '--to[which version to display to]' \ 102 | ':portage:_packages available' && ret=0 103 | ;; 104 | check|k) 105 | _arguments \ 106 | '(-f --full-regex)'{-f,--full-regex}'[supplied query is a regex]:pattern:' \ 107 | '(-o --only-failures)'{-o,--only-failures}'[only display packages that do not pass]' \ 108 | ':portage:_packages installed' && ret=0 109 | ;; 110 | depends|d) 111 | _arguments \ 112 | '(-a --all-packages)'{-a,--all-packages}'[search in all available packages (slow)]:all packages:->packages' \ 113 | '(-D --indirect)'{-D,--indirect}'[search indirect dependencies (VERY slow)]' \ 114 | '--depth[limit indirect dependency tree to specified depth]:number:' \ 115 | '*:package:_packages installed' && ret=0 116 | ;; 117 | depgraph|g) 118 | _arguments \ 119 | '(-A --no-atom)'{-A,--no-atom}'[do not show dependency atom]' \ 120 | '(-M --no-mask)'{-M,--no-mask}'[do not show masking status]' \ 121 | '(-U --no-useflags)'{-U,--no-useflags}'[do not show USE flags]' \ 122 | '(-l --linear)'{-l,--linear}'[do not use fancy formatting]' \ 123 | ':package:_packages installed' && ret=0 124 | ;; 125 | files|f) 126 | _arguments \ 127 | '(-m --md5sum)'{-m,--md5sum}'[include MD5 sum in output]' \ 128 | '(-s --timestamp)'{-s,--timestamp}'[include timestamp in output]' \ 129 | '(-t --type)'{-t,--type}'[include file type in output]' \ 130 | '--tree[display results in a tree (turns off other options)]' \ 131 | '--filter=[filter output]:filter(s):_values -s , "" dir obj sym dev fifo path conf cmd doc man info' \ 132 | ':installed pkgname:_packages installed' && ret=0 133 | ;; 134 | has|a) 135 | _arguments \ 136 | $common_args \ 137 | '(-F --format)'{-F,--format}'[a format template (see man page)]:format template' \ 138 | ':KEY:' \ 139 | ':VALUE:' && ret=0 140 | ;; 141 | hasuse|h) 142 | _arguments \ 143 | $common_args \ 144 | '(-F --format)'{-F,--format}'[specify a custom output format]:format template' \ 145 | ':useflag:_gentoo_packages useflag' && ret=0 146 | ;; 147 | list|l) 148 | _arguments \ 149 | $common_args \ 150 | '(-d --duplicates)'{-d,--duplicates}'[list only installed duplicate packages]' \ 151 | '(-b --binpkgs-missing)'{-b,--binpkgs-missing}'[list only installed packages without a corresponding binary package]' \ 152 | '(-f --full-regex)'{-f,--full-regex}'[supplied query is a regex]:pattern:' \ 153 | '(-m --mask-reason)'{-m,--mask-reason}'[include reason for package mask]' \ 154 | '(-F --format)'{-F,--format}'[a format template (see man page)]:format template' \ 155 | ': :_guard "^--*" pattern' && ret=0 156 | ;; 157 | meta|m) 158 | _arguments \ 159 | '(-d --description)'{-d,--description}'[show an extended package description]' \ 160 | '(-H --herd)'{-H,--herd}'[show the herd(s) for the package]' \ 161 | '(-k --keywords)'{-k,--keywords}'[show keywords for all matching package versions]' \ 162 | '(-l --license)'{-l,--license}'[show licenses for the best maching version]' \ 163 | '(-m --maintainer)'{-m,--maintainer}'[show the maintainer(s) for the package]' \ 164 | '(-S --stablreq)'{-S,--stablreq}'[show STABLEREQ arches (ccs) for all matching package versions]' \ 165 | '(-u --useflags)'{-u,--useflags}'[show per-package USE flag descriptions]' \ 166 | '(-U --upstream)'{-U,--upstream}'[show packages upstream information]' \ 167 | '(-x --xml)'{-x,--xml}'[show the plain metadata.xml file]' \ 168 | ':package:_packages available' && ret=0 169 | ;; 170 | size|s) 171 | _arguments \ 172 | '(-b --bytes)'{-b,--bytes}'[report size in bytes]' \ 173 | '(-f --full-regex)'{-f,--full-regex}'[supplied query is a regex]:pattern:' \ 174 | ':package:_packages installed' && ret=0 175 | ;; 176 | uses|u) 177 | _arguments \ 178 | '(-a --all)'{-a,--all}'[include non-installed packages]' \ 179 | '(-i --ignore-linguas)'{-i,--ignore-linguas}"[don't show linguas USE flags]" \ 180 | ":portage:_packages installed" && ret=0 181 | ;; 182 | which|w) 183 | _arguments \ 184 | '(-m --include-masked)'{-m,--include-masked}'[return highest version ebuild available]' \ 185 | '(-e --ebuild)'{-e,--ebuild}'[print the ebuild]' \ 186 | ':portage:_packages available' && ret=0 187 | ;; 188 | *) 189 | _message 'command not found' 190 | ;; 191 | esac 192 | fi 193 | ;; 194 | subcommands) 195 | tmp=( 196 | {belongs,b}'[list all packages owning file(s)]' 197 | {check,k}'[check MD5sums and timestamps of package]' 198 | {changes,c}'[shows ChangeLog for specified package]' 199 | {depends,d}'[list all packages depending on specified package]' 200 | {depgraph,g}'[display a dependency tree for package]' 201 | {files,f}'[list files owned by package]' 202 | {hasuse,h}'[list all packages with specified useflag]' 203 | {list,l}'[list all packages matching pattern]' 204 | {size,s}'[print size of files contained in package]' 205 | {uses,u}'[display USE flags for package]' 206 | {which,w}'[print full path to ebuild for package]' 207 | {has,a}'[list all installed packages where specified KEY matches the specified VALUE]' 208 | {keywords,y}'[display keywords for specified PKG]' 209 | {meta,m}'[display metadata about PKG]' 210 | ) 211 | _values 'equery command' $tmp && ret=0 212 | ;; 213 | esac 214 | done 215 | } 216 | 217 | _eclean_wrapper () { 218 | local global_opts pkg_opts dist_opts 219 | 220 | global_opts=( 221 | '(-C --nocolor)'{-C,--nocolor}'[turns off colors]' 222 | '(-d,--destructive)'{-d,--destructive}'[only keep the minimum for a reinstallation]' 223 | '(-e,--exclude-file)'{-e,--exclude-file}'[path to the exclusion file]:filename:_files' 224 | '(-i,--interactive)'{-i,--interactive}'[ask confirmation before deletions]' 225 | '(-n,--package-names)'{-n,--package-names}'[protect all versions (when --destructive)]' 226 | '(-p,--pretend)'{-p,--pretend}'[only display what would be cleaned]' 227 | '(-q,--quiet)'{-q,--quiet}'[minimal output]' 228 | '(-t,--time-limit)'{-t,--time-limit}'[don’t delete files modified since