diff options
author | Dawid Węgliński <cla@gentoo.org> | 2009-12-05 10:39:27 +0100 |
---|---|---|
committer | Dawid Węgliński <cla@gentoo.org> | 2009-12-05 10:39:27 +0100 |
commit | c8cb0ba705091f9c95df94f5ae44c5f6f18f10c7 (patch) | |
tree | d0ece4583308574ccd5fb69528554087700283ef | |
parent | The script really requires bash (diff) | |
download | zsh-completion-c8cb0ba705091f9c95df94f5ae44c5f6f18f10c7.tar.gz zsh-completion-c8cb0ba705091f9c95df94f5ae44c5f6f18f10c7.tar.bz2 zsh-completion-c8cb0ba705091f9c95df94f5ae44c5f6f18f10c7.zip |
Import 20091203
-rw-r--r-- | _baselayout | 80 | ||||
-rw-r--r-- | _eix | 193 | ||||
-rw-r--r-- | _eselect | 155 | ||||
-rw-r--r-- | _gcc-config | 2 | ||||
-rw-r--r-- | _genlop | 9 | ||||
-rw-r--r-- | _gentoo_packages | 21 | ||||
-rw-r--r-- | _gentoolkit | 313 | ||||
-rw-r--r-- | _layman | 6 | ||||
-rw-r--r-- | _portage | 228 | ||||
-rw-r--r-- | _portage_utils | 32 |
10 files changed, 802 insertions, 237 deletions
diff --git a/_baselayout b/_baselayout new file mode 100644 index 0000000..9ff8360 --- /dev/null +++ b/_baselayout @@ -0,0 +1,80 @@ +#compdef rc-update rc-status rc + +# baselayout 1.12.11.1 +# +# rc (fully done) +# rc-update (fully done) +# rc-status (fully done) + + +local gentoo_runlevels +gentoo_runlevels=(/etc/runlevels/*(:t)) + + +# Stuff for rc +_rc () { + if (( CURRENT == 2 )); then + _values "runlevels" $gentoo_runlevels + fi +} + + +# Stuff for rc-status +_rc-status () { + _arguments -s \ + {'(--all)-a','(-a)--all'}'[Show services at all run levels]' \ + {'(--list)-l','(-l)--list'}'[Show list of run levels]' \ + {'(--nocolor)-nc','(-nc)--nocolor'}'[Disable color output]' \ + {'(--servicelist)-s','(-s)--servicelist'}'[Show all services]' \ + {'(--unused)-u','(-u)--unused'}'[Show services not assigned to any run level]' + + _values 'runlevels' $gentoo_runlevels +} + + +# Stuff for rc-update +_rc-update () { + local used_init + + used_init=(${=${(M)${(f)"$(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 "scripts" /etc/init.d/*~*.sh(:t) + ;; + del|-d) + _values "scripts" $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 +} + + +case "$service" in + rc-update) + _rc-update "$@" && return 0 + ;; + rc-status) + _rc-status "$@" && return 0 + ;; + rc) + _rc "$@" && return 0 + ;; +esac + @@ -0,0 +1,193 @@ +#compdef eix + +# options from eix --help +# eix 0.10.3 (gcc-4.2.2, x86_64-pc-linux-gnu) +# + + +# category of options +local global_exclusives_opts \ + global_special \ + global_output \ + local_misc \ + local_search_field \ + local_type_of_pattern + +global_exclusives_opts=( + {'(--help)-h','(-h)--help'}'[show help and exit]' + {'(--version)-V','(-V)--version'}'[show version and exit]' + '--dump[dump variables to stdout]' + '--dump-defaults[dump default values of variables]' + '--print[print the expanded value of a variable]' + '--print-all-useflags[print all IUSE words used in some version]' + '--print-all-keywords[print all KEYWORDS used in some version]' + '--print-all-slots[print all SLOT strings used in some version]' + '--print-all-provides[print all PROVIDE strings used in some package]' + '--print-all-licenses[print all LICENSE strings used in some package]' + '--print-world-sets[print the world sets]' + '--print-overlay-path[print the path of specified overlay]' + '--print-overlay-label[print label of specified overlay]' +) + +global_special=( + {'(--test-non-matching)-t','(-t)--test-non-matching'}'[print non-matching entries of /etc/portage/package.* and non-matching names of installed packages]' + {'(--quick)-Q','(-Q)--quick'}"[(toggle) don't read unguessable slots of installed packages]" + '--care[always read slots of installed packages]' + '--cache-file[use another cache-file instead of /var/cache/eix]' +) + +global_output=( + {'(--quiet)-q','(-q)--quiet'}'[(toggle) (no) output]' + {'(--nocolor)-n','(-n)--nocolor'}'[do not use ANSI color codes]' + {'(--force-color)-F','(-F)--force-color'}'[force colorful output]' + {'(--pure-packages)-\\*','(-\\*)--pure-packages'}'[Omit printing of overlay names and package number]' + '--only-names[print with format <category>/<name>]' + {'(--compact)-c','(-c)--compact'}'[(toggle) compact search results]' + {'(--verbose)-v','(-v)--verbose'}'[(toggle) verbose search results]' + {'(--versionsort)-x','(-x)--versionsort'}'[(toggle) sort output by slots/versions]' + {'(--versionlines)-l','(-l)--versionlines'}'[(toggle) print available versions line-by-line]' \ + '--format[format string for normal output]' + '--format-compact[format string for compact output]' + '--format-verbose[format string for verbose outp]' +) + +local_misc=( + {'(--installed)-I','(-I)--installed'}'[Next expression only matches installed packages]' + {'(--multi-installed)-i','(-i)--multi-installed'}'[Match packages installed in several versions]' + {'(--dup-packages)-d','(-d)--dup-packages'}'[Match duplicated packages]' + {'(--dup-versions)-D','(-D)--dup-versions'}'[Match packages with duplicated versions]' + {'(--slotted)-1','(-1)--slotted'}'[Match packages with a nontrivial slot]' + {'(--slots)-2','(-2)--slots'}'[Match packages with two different slots]' + {'(--upgrade)-u','(-u)--upgrade'}'[Match packages without best slotted version]' + '--stable[Match packages with a stable version]' + '--testing[Match packages with a testing or stable version]' + '--non-masked[Match packages with a non-masked version]' + '--system[Match system packages]' + '--installed-unstable[Match packages with a non-stable installed version]' + '--installed-testing[Match packages with a testing installed version]' + '--installed-masked[Match packages with a masked installed version]' + '--world[Match world packages]' + '--world-all[Match packages of world or of a world set]' + '--world-set[Match packages of a world set]' + {'(--overlay)-O','(-O)--overlay'}'[Match packages from overlays]' + '--in-overlay[OVERLAY Match packages from OVERLAY]' + '--only-in-overlay[OVERLAY Match packages only in OVERLAY]' + {'(--installed-overlay)-J','(-J)--installed-overlay'}'[Match packages installed from overlays]' + '--installed-from-overlay[OVERLAY Packages installed from OVERLAY]' + '--installed-in-some-overlay[Packages with an installed version provided by some overlay]' + '--installed-in-overlay[OVERLAY Packages with an installed version provided from OVERLAY]' + '--restrict-fetch[Match packages with a fetch restriction]' + '--restrict-mirror[Match packages with a mirror restriction]' + '--restrict-primaryuri[Match packages with RESTRICT=primaryuri]' + '--restrict-binchecks[Match packages with RESTRICT=binchecks]' + '--restrict-strip[Match packages with RESTRICT=strip]' + '--restrict-test[Match packages with RESTRICT=test]' + '--restrict-userpriv[Match packages with RESTRICT=userpriv]' + '--restrict-installsources[Match packages with RESTRICT=installsources]' + '--restrict-bindist[Match packages with RESTRICT=bindist]' + '--properties-interactive[Match packages with PROPERTIES=interactive]' + '--properties-live[Match packages with PROPERTIES=live]' + '--properties-virtual[ Match packages with PROPERTIES=virtual]' + '--properties-set[Match packages with PROPERTIES=set]' + {'(--test-obsolete)-T','(-T)--test-obsolete'}'[Match packages with obsolete entries in /etc/portage/package.*]' + {'(--not)-!','(-!)--not'}'[(toggle) Invert the expression]' + {'(--pipe)-\\|','(-\\|)--pipe'}'[Use input from pipe of emerge -pv]' +) + +local_search_field=( + {'(--description)-S','(-S)--description'}'[description]' + {'(--category-name)-A','(-A)--category-name'}'["category/name"]' + {'(--category)-C','(-C)--category'}'[category]' + {'(--name)-s','(-s)--name'}'[name (default)]' + {'(--homepage)-H','(-H)--homepage'}'[homepage]' + {'(--license)-L','(-L)--license'}'[license]' + {'(--provide)-P','(-P)--provide'}'[provides]' + {'(--use)-U','(-U)--use'}'[useflag (of the ebuild)]' + '--installed-with-use[enabled useflag (of installed package)]' + '--installed-without-use[disabled useflag (of installed package)]' +) + +local_type_of_pattern=( + {'(--regex)-r','(-r)--regex'}'[Pattern is a regexp (default)]' + {'(--exact)-e','(-e)--exact'}'[Pattern is the exact string]' + {'(--substring)-z','(-z)--substring'}'[Pattern is a substring]' + {'(--begin)-b','(-b)--begin'}'[Pattern is the beginning of the string]' + '--end[Pattern is the end of the string]' + {'(--pattern)-p','(-p)--pattern'}'[Pattern is a wildcards-pattern]' + {'(--fuzzy)-f','(-f)--fuzzy'}'[Use fuzzy-search with a max. levenshtein-distance m (default: 2)]' +) + + +local prev="$words[CURRENT-1]" # previous word +local _gentoo_packages_scope # used to restrict the package scope (installed,category,useflag...) + +# global exclusiv opts, no more completion. +if (( $words[(I)(-[[:alnum:]]#(h|V)[[:alnum:]]#|--(help|version|dump|dump-defaults))] )); then + return 0 +# already have a --print ARG option. no more completion. +elif (( $words[(I)(--print)] )) && [[ "$prev" != '--print' ]]; then + return 0 +else + case "$prev" in +# eix variables for --print + '--print' ) + local vars + vars=(${${(M)${(f)"$(eix --dump)"}##[A-Z]*}%%\=*}) + _values 'variables' $vars + return 0 + ;; + +# files for --cache-file + '--cache-file' ) + _arguments -s '*:filename:_files' + return 0 + ;; + +# overlays for --only-in-overlay|--in-overlay|--installed-from-overlay|--installed-in-overlay + --((only-|)in|installed-(from|in))-overlay ) + for f in /etc/make.conf /etc/make.globals; do + [[ -z "$PORTDIR_OVERLAY" && -r "$f" ]] && + local PORTDIR_OVERLAY="`. "$f" 2>/dev/null; echo ${PORTDIR_OVERLAY}`" + done + + _values 'overlays' $=PORTDIR_OVERLAY + return 0 + ;; + +# useflags for -U|--use|--installed-with-use|--installed-without-use + (-[[:alnum:]]#U|--(use|installed-with(out|)-use)) ) + _gentoo_packages_scope='*:package:_gentoo_packages useflag' + ;; + +# category for -C|--category + -([[:alnum:]]#C|-category) ) + _gentoo_packages_scope='*:package:_gentoo_packages category' + ;; + + * ) + #if (( $words[(I)(-[[:alnum:]]#2[[:alnum:]]#|--slots)] )); then + # local pkgs + # pkgs=(${${(f)"$(eix -2 --only-names)"}##*/}) + # _values 'packages' $pkgs && return 0 + + # installed packages for -i|--installed|-I|--multi-installed|-T|--test-obsolete + if (( $words[(I)(-[[:alnum:]]#(i|I|T)[[:alnum:]]#|--(((multi-|)installed)|test-obsolete))] )); then + _gentoo_packages_scope='*:package:_gentoo_packages installed' + # only packages names (no category) for -s|--name + elif (( $words[(I)(-[[:alnum:]]#s[[:alnum:]]#|--name)] )); then + _gentoo_packages_scope='*:package:_gentoo_packages available_pkgnames_only' + else # default + _gentoo_packages_scope='*:package:_gentoo_packages available' + fi + ;; + esac +fi + +_arguments -s $global_exclusives_opts \ + $global_special \ + $global_output \ + $local_misc \ + $local_search_field \ + $local_type_of_pattern \ + $_gentoo_packages_scope && + return 0 @@ -1,7 +1,128 @@ #compdef eselect -#Author: David Durrleman -#Contributor : Baptiste Daroussin <baptiste.daroussin@gmail.com> +_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" \ + "help[Display help text]" \ + "usage[Display usage information]" \ + "version[Display version information]" \ + 'update[Collect environment variables from all scripts]' && return 0 +} + +_eselect_binutils () { + local binutilslist + if (( $words[(I)(set)] )); then + binutilslist=(${${${(M)${(f)"$(eselect --no-color binutils list)"}## *}// \**/}//( \[*\] | \[*\] )/}) + _values "available binutils version" $binutilslist[@] && return 0 + fi + _values "binutils options" \ + "help[Display help text]" \ + "usage[Display usage information]" \ + "version[Display version information]" \ + "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=(${${${(M)${(f)"$(eselect --no-color kernel list)"}## *}// \**/}//( \[*\] | \[*\] )/}) + _values "available kernel version" $kernellist[@] && return 0 + fi + _values "kenrel options" \ + "help[Display help text]" \ + "usage[Display usage information]" \ + "version[Display version information]" \ + "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=(${${${(M)${(f)"$(eselect --no-color ctags list)"}## *}// \**/}//( \[*\] | \[*\] )/}) + _values "available ctags version" $ctagslist[@] && return 0 + fi + _values "ctags options" \ + "help[Display help text]" \ + "usage[Display usage information]" \ + "version[Display version information]" \ + "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=(${${${(M)${(f)"$(eselect --no-color profile list)"}## *}// \**/}//( \[*\] | \[*\] )/}) + _values -w "available profiles" $profilelist[@] \ + "--force[Forcibly set the symlink]" && return 0 + fi + _values "profile options" \ + "help[Display help text]" \ + "usage[Display usage information]" \ + "version[Display version information]" \ + "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 --no-color fontconfig list)"}## *}#*\*}// \**/}//( \[*\] | \[*\] )/}) + _values -w ".conf to enable" $fclistdisabled[@] && return 0 + elif (( $words[(I)(disable)] )); then + fclistenabled=(${${${(M)${(M)${(f)"$(eselect --no-color fontconfig list)"}## *}#*\*}// \**/}//( \[*\] | \[*\] )/}) + _values -w ".conf to disable" $fclistenabled[@] && return 0 + fi + _values "fontconfig options" \ + "help[Display help text]" \ + "usage[Display usage information]" \ + "version[Display version information]" \ + "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=(${${${(M)${(f)"$(eselect --no-color opengl list)"}## *}// \**/}//( \[*\] | \[*\] )/}) + _values -w "opengl implementations and options" $opengllist[@] \ + "--use-old[If an implementationis already set, use that one instead]" \ + "--prefix[Set the source prefix]:path:_files -/" \ + "--dst-prefix[Set the destination prefix]:path:_files -/" \ + "--impl-headers[Override global headers with ones provided by this profile]" && return 0 + fi + _values "opengl options" \ + "help[Display help text]" \ + "usage[Display usage information]" \ + "version[Display version information]" \ + "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=(${${${(M)${(f)"$(eselect --no-color 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" \ + "help[Display help text]" \ + "usage[Display usage information]" \ + "version[Display version information]" \ + "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 () { local globopts sedcmd modnames modopts @@ -20,15 +141,29 @@ _eselect () { _arguments -s \ "*:portage:_values 'eselect modules' \$modnames[@]" && return 0 elif (( $modnames[(I)$words[2]] )); then - modopts=(${${${(M)${(f)"$(eselect --no-color $words[2] usage)"}## *}// */}// /}) - _arguments -s \ - "*:portage:_values 'eselect $words[2] options' \$modopts[@]" && return 0 + if [[ "$words[2]" == (env|binutils|kernel|ctags|profile|fontconfig|opengl|vi) ]]; then + _eselect_$words[2] "$@" + else + modopts=(${${${(M)${(f)"$(eselect --no-color $words[2] usage)"}## *}// */}// /}) + _arguments -s \ + "*:portage:_values 'eselect $words[2] options' \$modopts[@]" && return 0 + fi fi - elif ((CURRENT == 4)); then - if (( $modnames[(I)$words[3]] )); then - modopts=(${${${(M)${(f)"$(eselect --no-color $words[3] usage)"}## *}// */}// /}) - _arguments -s \ - "*:portage:_values 'eselect $words[3] options' \$modopts[@]" && return 0 + elif ((CURRENT >= 4)); then + if (( $words[(I)(--no-color|--no-colour)] )); then + if (( $modnames[(I)$words[3]] )); then + if [[ "$words[3]" == (env|binutils|kernel|ctags|profile|fontconfig|opengl|vi) ]]; then + _eselect_$words[3] "$@" + else + modopts=(${${${${(M)${(f)"$(eselect --no-color $words[3] usage)"}## *}// */}// /}// *}) + _arguments -s \ + "*:portage:_values 'eselect $words[3] options' \$modopts[@]" && return 0 + fi + fi + else + if (( $modnames[(I)$words[2]] )); then + _eselect_$words[2] "$@" + fi fi fi } diff --git a/_gcc-config b/_gcc-config index a2fd33b..d6e5bb8 100644 --- a/_gcc-config +++ b/_gcc-config @@ -19,7 +19,7 @@ arguments=( _gcc_profile(){ local profile - profile=(${(f)"$(_call_program gcc-installed gcc-config --list-profiles)"}) + profile=(${(f)"$(_call_program gcc-installed RC_NOCOLOR=yes gcc-config --list-profiles)"}) profile=${${profile/\[([^]]*)\]/}/\*} _tags profile && { compadd "$@" -k profile || compadd "$@" ${(kv)=profile} } } @@ -1,13 +1,6 @@ #compdef genlop -# ZSH completion function for genlop -# -# Original authors of portage completion -# Author: baptux <bapt@ifrance.com> -# Author: Mamoru KOMACHI <usata@gentoo.org> -# -# Adapted for genlop by oberyno <oberyno@gmail.com> - +#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) diff --git a/_gentoo_packages b/_gentoo_packages index a912773..f1a0278 100644 --- a/_gentoo_packages +++ b/_gentoo_packages @@ -1,7 +1,5 @@ #autoload -#Author: baptux <bapt@ifrance.com> -#Author: oberyno <oberyno@gmail.com> #Description: # functions for gentoo packages # inspired by _deb_packages @@ -65,6 +63,21 @@ _gentoo_packages_update_installed_versions(){ _wanted cat_packages expl 'category/package' _multi_parts "$@" / installed_list } +_gentoo_packages_update_available_pkgnames_only(){ + local var trees packages + + for var in PORTDIR PORTDIR_OVERLAY ; do + [[ -z ${(P)var} && -r /etc/make.conf ]] && + local $var="`. /etc/make.conf 2>/dev/null; echo ${(P)var}`" + [[ -z ${(P)var} && -r /etc/make.globals ]] && + local $var="`. /etc/make.globals 2>/dev/null; echo ${(P)var}`" + done + trees=( $PORTDIR $=PORTDIR_OVERLAY) + + packages=( $trees/*-*/*(:t) ) + _wanted packages expl 'package' compadd - "${(@)packages}" +} + _gentoo_packages_update_available(){ local var trees category packages pkg expl @@ -133,11 +146,11 @@ _gentoo_packages () { if [[ -z "$update_policy" ]]; then zstyle ":completion:*:*:$service:*" cache-policy _gentoo_cache_policy fi - [[ "$command" == (installed(_versions|)|available(_versions|)|binary|category|useflag|active_useflag) ]] || { + [[ "$command" == (installed(_versions|)|available(_versions|)|binary|category|(active_|)useflag|available_pkgnames_only) ]] || { _message "unknown command: $command" return } - [[ "$pkgset" == (installed(_versions|)|available(_versions|)|binary|category|useflag|active_useflag) ]] || { + [[ "$pkgset" == (installed(_versions|)|available(_versions|)|binary|category|(active_|)useflag|available_pkgnames_only) ]] || { pkgset="$command" } expl=("${(@)argv[1,-2]}") diff --git a/_gentoolkit b/_gentoolkit index 17f12d5..2a87bd7 100644 --- a/_gentoolkit +++ b/_gentoolkit @@ -1,68 +1,28 @@ -#compdef gensync equery qpkg euse eclean +#compdef equery euse eclean eclean-dist eclean-pkg epkginfo genpkgindex glsa-check revdep-rebuild -# Author: oberyno <oberyno@gmail.com> -# Author: baptux <baptiste.daroussin@gmail.com> +# 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* -#Function to show gensync overlays located in /etc/gensync -_overlays(){ - local overlay gensynclist gensync_individual - gensynclist=(/etc/gensync/*.syncsource) - foreach gensync_individual ($gensynclist) - overlay=($overlay ${${${(M)${(f)"$(<$gensync_individual)"}##id=*}/id=\"/}%\"}) - end - _tags overlay && { compadd "$@" ${(kv)=overlay} } -} -_packages(){ +# XXX: shouldn't this go to _gentoo_package? +_packages () { if compset -P '(\\|)(>=|<=|<|>|=)' ; then - _gentoo_packages ${*/(#m)(installed|available)/${MATCH}_versions} + _gentoo_packages ${*/(#m)(installed|available)/${MATCH}_versions} else - _gentoo_packages $* + _gentoo_packages $* fi - } - -case $service in - - gensync) - _arguments \ - '(- :)'{--list-sources,-l}'[list known rsync sources]' \ - '()'{--no-color,-C}'[turn off colours]:overlays:_overlays' \ - '(- :)'{--help,-h}'[show help]' \ - '(- :)'{--version,-V}'[display version info]' \ - '(- :):overlays:_overlays' -;; +} - qpkg) - excl=( --help -h --query-deps -q ) - check=( --check-md5 -cm --check-time -ct --check -c ) - arg=( --info -i --list -l --non-masked -n --masked -m --installed -I --uninstalled -U --group -g ) - find=( --find-file -f --find-pattern -fp ) - dups=( --dups -d --slot -s) - - _arguments -s \ - "($check $excl $find $dups 1)"{--find-file,-f}"[finds package that owns file]:file:_files" \ - "($check $excl $find $dups 1)"{--find-pattern,-fp}"[finds package that owns file matching pattern]:pattern:" \ - "($excl $check $arg $find --dups -d )"{--dups,-d}"[print packages that have multiple versions installed]" \ - "($excl $check $arg $find --slot -s 1)"{--slot,-s}"[only print duplicates of the same slot]" \ - "($check $excl --installed -I --uninstalled -U $dups -d)"{--uninstalled,-U}"[include only uninstalled packages]" \ - "($excl --uninstalled -U --installed -I $dups -d)"{--installed,-I}"[include only installed packages]" \ - "($excl --group -g $dups -d)"{--group,-g}"[find by group]:group:_gentoo_packages category" \ - "($check $excl --list -l $dups -d)"{--list,-l}"[list package contents]" \ - "($excl --info -i $dups -d 1)"{--info,-i}"[get package description and home page]:package:_gentoo_packages available" \ - "($excl $check $find $dups --uninstalled -U)"{--check-time,-ct}"[verify package file timestamps]" \ - "($excl $check $find $dups --uninstalled -U)"{--check-md5,-cm}"[verify package files md5]" \ - "($excl $check $find $dups --uninstalled -U)"{--check,-c}"[verify mtimes and md5]" \ - "($excl $find --query-deps -q $dups -d 1)"{--query-deps,-q}"[display all installed packages depending on selected packages]:package:_gentoo_packages available" \ - "()"{--no-color,-nc}"[dont use colors]" \ - "*--verbose[be more verbose (2 levels)]" \ - "*-v[be more verbose (2 levels)]" \ - "($excl --non-masked -n --masked -m $dups)"{--masked,-m}"[include only masked packages]" \ - "($excl --non-masked -n --masked -m $dups)"{--non-masked,-n}"[include only non-masked packages]" \ - "(- :)"{--help,-h}"[show help]" \ - "(--info -i --query-deps -q --slot -s)1:package:_gentoo_packages installed_versions" -;; -euse) +_euse () { local state tmp start_args suboptions_args start_args=( {'(--help)-h','(-h)--help'}'[show help]' @@ -97,9 +57,10 @@ euse) _arguments \ '*:useflag:_gentoo_packages useflag' && ret=0 fi -;; +} + -equery) +_equery () { # Based off of X/_xauth. local state context line expl ret=1 local tmp cmd start_args common_args @@ -212,60 +173,188 @@ equery) ;; esac done -;; -eclean) - local state context line expl ret=1 - local tmp cmd global_option common_args +} + + +_eclean_wrapper () { + local global_opts pkg_opts dist_opts - global_option=( - {'(--nocolor)-C','(-C)--nocolor'}'[turns off colors]' - {'(--destructive)-d','(-d)--destructive'}'[only keep the minimum for a reinstallation]' - {'(--exclude-file)-e','(-e)--exclude-file'}'[path to the exclusion file]' - {'(--interactive)-i','(-i)--interactive'}'[ask confirmation before deletions]' - {'(--package-names)-n','(-n)--package-names'}'[protect all versions (when --destructive)]' - {'(--pretend)-p','(-p)--pretend'}'[only display what would be cleaned]' - {'(--quiet)-q','(-q)--quiet'}'[minimal output]' - {'(--help)-h','(-h)--help'}'[show help]' - {'(--version)-V','(-V)--version'}'[show version]' - ) + 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' +} - 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 $global_option \ - '*::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] - case "$cmd" in - packages) - ;; - distfiles) - _arguments -s \ - '(-f --fetch-restricted)'{-f,--fetch-restricted}'[protect fetch-restricted files (when --destructive)]' \ - '(-s --size-limit)'{-s,--size-limit}'[do not delete disfiles bigger than <size>]:size:' - ;; - esac - fi - ;; - subcommands) - tmp=( - {packages,}'[clean outdated binary packages]' - {distfiles,}'[clean outdated packages sources files]' - ) - _values 'eclean command' $tmp && ret=0 - ;; - esac - done -;; + +_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 @@ -1,9 +1,11 @@ #compdef layman -#Author Baptiste Daroussin <baptiste.daroussin@gmail.com> + +# 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 -N -L)"}//\[*}#\* }) + layman_list_overlays=(${(S)${${(f)"$(layman -k -N -L 2>/dev/null)"}//\[*}#\* }) compadd "$@" ${(kv)=layman_list_overlays} "ALL" } _layman_local_overlays() { @@ -1,38 +1,17 @@ -#compdef emerge rc-update rc-status ebuild opengl-update rc quickpkg - -# $Id: _portage,v 1.2 2005/02/22 14:22:54 usata Exp $ - -# ZSH completion function for Portage -# Author: baptux <bapt@ifrance.com> -# Author: Mamoru KOMACHI <usata@gentoo.org> -# Author: oberyno <oberyno@gmail.com> +#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) # -# emerge (fully done) -# rc-update (fully done) -# rc-status (fully done) -# ebuild (fully done) -# opengl-update (fully done) -# rc (fully done) - -# Stuff for rc -_rc () { - if (( CURRENT == 2 ));then - _values "runlevels" $gentoo_runlevels - fi -} +# Still TODO: +# xpak -# Stuff for opengl-update (the easiest to do :) ) - -_opengl-update () { - if (( CURRENT == 2 ));then - _values "opengl-update options" \ - 'xorg-x11[Use libGL.so from X.Org]' \ - 'xfree[Use libGL.so from XFree86]' \ - 'nvidia[Use libGL.so from the NVidia drivers.]' - fi -} # Stuff for ebuild _ebuild () { @@ -57,58 +36,12 @@ _ebuild () { '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 rc-status -_rc-status () { - if (( CURRENT == 2 ));then - _values "rc-status options" \ - '-a[Show services at all run levels]' \ - '--all[Show services at all run levels]' \ - '-l[Show list of run levels]' \ - '--list[Show list of run levels]' \ - '-u[Show services not assigned to any run level]' \ - '--unused[Show services not assigned to any run level]' \ - $gentoo_runlevels - fi -} - -# Stuff for rc-update - -_rc-update () { -local used_init - used_init=(${=${(M)${(f)"$(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 "scripts" /etc/init.d/*~*.sh(:t) - ;; - del|-d) - _values "scripts" $used_init - ;; - show|-s) - _values "runlevels" $gentoo_runlevels - ;; - esac - elif (( CURRENT == 4 ));then - case "$words[2]" in - add|-a|del|-d) - _values "runlevels" $gentoo_runlevels - ;; - esac - fi -} # Stuff for quickpkg @@ -150,6 +83,8 @@ _emerge () { '(--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]' + #'--deselect[--deselect=n Remove atom from world file]' + '--deselect=[Remove atom from world file]' ) install_args=( "($bopts)"{-b,--buildpkg}"[Tells emerge to build binary packages]" @@ -196,7 +131,7 @@ _emerge () { # Dispatch - if (( $words[(I)(--(unmerge|clean|prune)|-[[:alpha:]]#(C|c|P)[[:alpha:]]#)] )) ; then + 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 @@ -206,7 +141,7 @@ _emerge () { "*:installed package:_gentoo_packages installed" && return 0 fi - elif (( $words[(I)(world|system)] )) ; then + elif (( $words[(I)(world|system)] )) ; then _arguments -s \ "$common_args[@]" "$install_args[@]" \ "($nopkg_opts[1,-2] --inject -i --oneshot -1):" && return 0 @@ -238,31 +173,134 @@ _emerge () { } +_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]' +} -local gentoo_runlevels -gentoo_runlevels=(/etc/runlevels/*(:t)) + +_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 ;; - rc-update) - _rc-update "$@" && return 0 - ;; - rc-status) - _rc-status "$@" && return 0 - ;; ebuild) _ebuild "$@" && return 0 ;; - opengl-update) - _opengl-update "$@" && return 0 - ;; - rc) - _rc "$@" && 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/_portage_utils b/_portage_utils index 343a477..d18bd12 100644 --- a/_portage_utils +++ b/_portage_utils @@ -1,7 +1,6 @@ -#compdef qatom qcheck qdepends qfile qgrep qimlate qlist qlop qsearch qsize quse +#compdef qatom qcheck qdepends qfile qgrep qcache qlist qlop qsearch qsize quse qtbz2 qpkg qxpak -# Author: baptux <baptiste.daroussin@gmail.com> -# +#portage-utils-0.19 # local common_args PORTDIR var=PORTDIR @@ -48,7 +47,7 @@ qgrep) {'(--regexp)-e','(-e)--regexp'}'[Use PATTERN as a regular expression]' \ '*:pattern::' ;; -qimlate) +qcache) local arches allarches arch show_archs(){ arches=(${(f)"$(<$PORTDIR/profiles/arch.list)"}) @@ -114,7 +113,30 @@ quse) {'(--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]' \ - {'(--name-only)-N','(-N)--name-only'}'[Only show package name]' \ + {'(--name-only)-N','(-N)--name-only'}'[Only show package name]' \ '*:use flag:_gentoo_packages useflag' ;; +qtbz2) + _arguments -s $common_args \ + {'(--join -s --split -t --tarbz2 -x --xpak)-j','(-t --tarbz2 -j -s --split -x --xpak)--join'}'[Join tar.bz2 + xpak into a tbz2]:*:tar.bz2 file and xpak file:_files -g \*.\(tar.bz2\|xpak\)' \ + {'(--join -j --split -t --tarbz2 -x --xpak)-s','(-t --tarbz2 -j --join -s -x --xpak)--split'}'[Split a tbz2 into a tar.bz2 + xpak]:tbz2 file:_files -g \*.tbz2' \ + {'(--join -j -s --split --tarbz2 -x --xpak)-t','(--join -j -s --split -t -x --xpak)--tarbz2'}'[Just split the tar.bz2]:tbz2 file:_files -g \*.tbz2' \ + {'(--join -j -s --split -t --tarbz2 --xpak)-x','(--join -j -s --split -t --tarbz2 -x)--xpak'}'[Just split the xpak]:tbz2 file:_files -g \*.tbz2' \ + {'(--stdout)-O','(-O)--stdout'}'[Write files to stdout]' +;; +qpkg) + _arguments -s $common_args \ + {'(--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 --extract -x --create -c)-l','(-l --extract -x --create -c)--list'}'[List the contents of an archive]:xpak archive:_files -g \*.xpak' \ + {'(--list -l --extract --create -c)-x','(--list -l -x --create -c)--extract'}'[Extract the contents of an archive]:xpak archive:_files -g \*.xpak' \ + {'(--list -l --extract -x --create)-c','(--list -l --extract -x -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 |