summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMamoru Komachi <usata@gentoo.org>2004-08-12 19:11:59 +0000
committerMamoru Komachi <usata@gentoo.org>2004-08-12 19:11:59 +0000
commit14ec693da85428456556c92a07ae9b0c8dfdacde (patch)
tree7fce120d4ecf870e940c7aa9a1081a003b293eef /app-shells/zsh/files
parentMake vi -r work, bug #58820 (diff)
downloadhistorical-14ec693da85428456556c92a07ae9b0c8dfdacde.tar.gz
historical-14ec693da85428456556c92a07ae9b0c8dfdacde.tar.bz2
historical-14ec693da85428456556c92a07ae9b0c8dfdacde.zip
New test release. Added completions for genlop, gensync, qpkg, equery, gcc-config and completion cache support for emerge. All these neat completions were contributed by oberyno <oberyno@gmail.com>, see bug #58198. Install Misc/* and Util/* scripts, see bug #54520.
Diffstat (limited to 'app-shells/zsh/files')
-rw-r--r--app-shells/zsh/files/_gcc-config25
-rw-r--r--app-shells/zsh/files/_genlop146
-rw-r--r--app-shells/zsh/files/_gentoolkit171
-rw-r--r--app-shells/zsh/files/_portage-20040730 (renamed from app-shells/zsh/files/_portage)226
-rw-r--r--app-shells/zsh/files/digest-zsh-4.1.1-r43
-rw-r--r--app-shells/zsh/files/digest-zsh-4.2.02
-rw-r--r--app-shells/zsh/files/digest-zsh-4.2.1_alpha13
7 files changed, 549 insertions, 27 deletions
diff --git a/app-shells/zsh/files/_gcc-config b/app-shells/zsh/files/_gcc-config
new file mode 100644
index 000000000000..68e61e70bbdd
--- /dev/null
+++ b/app-shells/zsh/files/_gcc-config
@@ -0,0 +1,25 @@
+#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/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(){
+ profile=$(_call_program tag gcc-config --list-profiles | sed -r -e 's/(\[([^]]*)\]) //g')
+ _tags profile && { compadd "$@" -k profile || compadd "$@" ${(kv)=profile} }
+}
+
+_arguments $arguments
diff --git a/app-shells/zsh/files/_genlop b/app-shells/zsh/files/_genlop
new file mode 100644
index 000000000000..763dc7697f80
--- /dev/null
+++ b/app-shells/zsh/files/_genlop
@@ -0,0 +1,146 @@
+#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 () {
+ local state prev1="$words[CURRENT-1]" prev2="$words[CURRENT-2]"
+ if (( CURRENT == 2 ));then
+ _arguments -s \
+ '*:*:->ebuilds' \
+ "$common_args[@]" "$general_args[@]" "$single_args[@]" && return 0
+ elif (( CURRENT > 2 ));then
+ case "$words[2]" in
+ --unmerge|-u)
+ _arguments -s \
+ '*:*:->install_portage' \
+ "$common_args[@]" "$general_args[@]" && return 0
+ ;;
+ --current|-c)
+ _arguments -s \
+ '*:only works when an emerge is in progress:' \
+ "$common_args[@]" && return 0
+ ;;
+ --pretend|-p)
+ _arguments -s \
+ '*:needs a piped emerge; otherwise will do nothing:' \
+ "$common_args[@]" && return 0
+ ;;
+ --date)
+ if [[ ${prev2} == (january|february|march|april|may|june|july|august|september|october|november|december|monday|tuesday|wednesday|thursday|friday|saturday|sunday) ]]
+ then _arguments -s \
+ '*:installed pkgname:_portage_installed' \
+ "$common_args[@]" "$general_args[@]" && return 0
+ elif [[ ${prev1} == (1) ]]
+ then _values "date" 'day ago' 'month ago' 'year ago' 'week ago' && return 0
+ elif [[ ${prev1} == ([2-9]|[1-9][0-9]*) ]]
+ then _values "date" 'days ago' 'months ago' 'years ago' 'weeks ago' && return 0
+ elif [[ ${prev1} == (last) ]]
+ then _values "date" month week
+ _arguments '*:*:_days' && return 0
+ elif [[ ${prev1} == (1st|2nd|3rd|4th|5th) ]]
+ then _arguments '*:*:_days' && return 0
+ elif [[ ${prev1} == (january|february|march|april|may|june|july|august|september|october|november|december) ]]
+ then compadd {1..31} && return 0
+ elif [[ ${prev2} == (1st|2nd|3rd|4th|5th) ]]
+ then compadd in\ {january,february,march,april,may,june,july,august,september,october,november,december} && return 0
+ elif [[ ${prev1} == --date ]]
+ then _values "enter number for more options or use mm/dd/yyyy format" \
+ last yesterday 1st 2nd 3rd 4th 5th
+ _alternative \
+ '*:*:_days' '*:*:_months' && return 0
+ else
+ _arguments -s \
+ '*:installed pkgname:_portage_installed' \
+ "$common_args[@]" "$general_args[@]" && return 0
+ fi
+ ;;
+
+ --rsync|-r|--list|-l)
+ _arguments -s \
+ "$common_args[@]" "$general_args[@]" && return 0
+ ;;
+ --version|-v|--help|-h)
+ _arguments -s \
+ "$common_args[@]" && return 0
+ ;;
+ *)
+ _arguments -s \
+ '*:*:->ebuilds' \
+ "$common_args[@]" "$general_args[@]" && return 0
+ ;;
+ esac
+ fi
+ while [[ -n "$state" ]]; do
+ lstate=$state
+ state=''
+ case "$lstate" in
+ ebuilds)
+ _alternative \
+ '*:installed packages:_portage_installed'
+ ;;
+ install_portage)
+ _alternative \
+ '*:installed packages:_portage_pkglist'
+ ;;
+ esac
+ done
+}
+
+_portage_installed(){
+ installed_portage=(/var/db/pkg/*-*/*)
+ installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}}
+ _tags installed_pkgname && { compadd "$@" ${(kv)=installed_pkgname} }
+ _path_files -/ -W /var/db/pkg/
+}
+#Function to show all available portage names
+_portage_pkglist(){
+ portage_pkglist="$portage_pkglist"
+ _tags -s portage_pkglist && { compadd "$@" ${(kv)=portage_pkglist} }
+ _path_files -/ -F "*CVSROOT" -F "*eclass" -F "*distfiles" -F "*licences" -F "*files" -W "${portdir}"
+ _path_files -g \*.ebuild
+}
+common_args=(
+ {'(-n)--nocolor','(--nocolor)-n'}'[disable colored output]'
+)
+
+general_args=(
+ {'(--time)-t','(-t)--time'}'[calculate merge time]'
+ {'(--gmt)-g','(-g)--gmt'}'[display time in GMT/UTC format (default is local time)]'
+ {'(--info)-i','(-i)--info'}'[prints brief summary about installed ebuild]'
+ {'(--file)-f','(-f)--file'}'[specify the logfile to use]:filename:_files'
+ {'(--rsync -r --unmerge)-u','(--rsync -r -u)--unmerge'}'[show when packages have been unmerged]'
+ '*--date[specify date of event]'
+ {'(--search -s --info -i --time -t --unmerge -u --rsync)-r','(--search -s --info -i --time -t --unmerge -u -r)--rsync'}'[looks for portage rsync/sync history]'
+ {'(--search -s --info -i --list)-l','(--search -s --info -i -l)--list'}'[list complete merge history]'
+ {'(--rsync -r --search)-s','(--rsync -r -s)--search'}'[select ebuilds matching the provided regular expression]:enter:_guard "^--*" search pattern'
+)
+
+single_args=(
+ {'(--current)-c','(-c)--current'}'[show the current merge in action]'
+ {'(--pretend)-p','(-p)--pretend'}'[take output from a piped emerge -p and calculate estimated build time]'
+ {'(--version)-v','(-v)--version'}'[output version information]'
+ {'(--help)-h','(-h)--help'}'[show help]'
+)
+
+_days() {
+ _values "" \
+ monday tuesday wednesday thursday friday saturday sunday
+}
+_months() {
+ _values "" \
+ january february march april may june july august september october november december
+}
+
+#Reading informations from make.conf
+portdir="$(portageq portdir)"
+#pkgdir="$(portageq pkgdir)"
+portdir_overlay="$(portageq portdir_overlay)"
+
+portage_pkglist=(${portdir}/*-*/* ${portdir_overlay}/*-*/*)
+portage_pkglist=(${portage_pkglist##*/})
diff --git a/app-shells/zsh/files/_gentoolkit b/app-shells/zsh/files/_gentoolkit
new file mode 100644
index 000000000000..37faa6af418d
--- /dev/null
+++ b/app-shells/zsh/files/_gentoolkit
@@ -0,0 +1,171 @@
+#compdef gensync equery qpkg
+
+# Author: oberyno <oberyno@gmail.com>
+
+#Function to show gensync overlays located in /etc/gensync
+_overlays(){
+ overlay=$(grep -h id= /etc/gensync/* | sed -e 's/id="\(.*\)"$/\1/')
+ _tags overlay && { compadd "$@" ${(kv)=overlay} }
+}
+
+#show portage categories without / at end; app-cdr instead of app-cdr/ -- this can probably be done with _files, but I'm lazy
+_category(){
+ categories=($portdir/metadata/cache/*-*)
+ category=${(M)${${categories##*/}}}
+_tags -s category && { compadd "$@" ${(kv)=category} }
+}
+
+#Function to show only installed packages -- pkgname (no category or version #)
+_portage_installed(){
+ installed_portage=(/var/db/pkg/*-*/*)
+ installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}}
+ _tags -s installed_pkgname && { compadd "$@" ${(kv)=installed_pkgname} }
+}
+#moved out of equery
+_equery_val(){
+ _values "equery actions" \
+ 'files[list files owned by pkg]' \
+ 'list[list all packages matching pattern]' \
+ 'belongs[list all packages owning file]' \
+ 'uses[display USE flags for package]' \
+ 'which[print full path to ebuild for package]' \
+ 'depgraph[display a dependency tree for package]' \
+ 'check[check files against recorded md5sums and timestamps]' \
+ 'size[print size of files contained in package]'
+ }
+
+#Function to show all available portage names
+_portage_pkglist(){
+ portage_pkglist="$portage_pkglist"
+ _tags -s portage_pkglist && { compadd "$@" ${(kv)=portage_pkglist} }
+ _path_files -/ -F "*CVSROOT" -F "*eclass" -F "*distfiles" -F "*licences" -W "${portdir}"
+}
+
+#Reading informations from Portage
+portdir="$(portageq portdir)"
+#pkgdir="$(portageq pkgdir)"
+portdir_overlay="$(portageq portdir_overlay)"
+
+portage_pkglist=(${portdir}/*-*/* ${portdir_overlay}/*-*/*)
+portage_pkglist=(${portage_pkglist##*/})
+
+
+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 \
+ "($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:_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:_portage_pkglist" \
+ "($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:_portage_pkglist" \
+ "()"{--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:_portage_installed"
+;;
+
+equery)
+ local prev="$words[CURRENT-1]" prev2="$words[CURRENT-2]"
+
+ if (( CURRENT == 2 ));then
+ _equery_val
+ _arguments \
+ $common_args && return 0
+ elif (( CURRENT > 2 ));then
+
+ case "$prev" in
+ files|--timestamp|--md5sum|--type)
+ _arguments -s \
+ '--timestamp[append timestamp]' \
+ '--md5sum[append md5sum]' \
+ '--type[prepend file type]' \
+ '*:installed pkgname:_portage_installed' && return 0
+ ;;
+ belongs|--earlyout)
+ _arguments -s \
+ '(-c --category)'{-c,--category}'[only search in specified category]' \
+ '(-e --earlyout)'{-e,--earlyout}'[stop when first match found]' \
+ '*:file:_files' && return 0
+ ;;
+ --category|-c)
+ _arguments -s \
+ '*:category:_category' && return 0
+ ;;
+ list|--installed|-i|--exclude-installed|-I|-p|--portage-tree|-o|--overlay-tree)
+ _arguments -s \
+ '(-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]' \
+ '*:package:_portage_installed' && return 0
+ ;;
+ uses|which)
+ _arguments \
+ '*:package:_portage_pkglist' \
+ && return 0
+ ;;
+ depgraph|-U|--no-useflags|-l|--linear)
+ _arguments -s \
+ '(-U --no-useflags)'{-U,--no-useflags}'[do not show USE flags]' \
+ '(-l --linear)'{-l,--linear}'[do not use fancy formatting]' \
+ '*:package:_portage_installed' \
+ && return 0
+ ;;
+ size|-b|--bytes)
+ _arguments -s \
+ '(-b --bytes)'{-b,--bytes}'[report size in bytes]' \
+ '*:package:_portage_installed' \
+ && return 0
+ ;;
+ check)
+ _arguments -s \
+ '*:package:_portage_installed' \
+ && return 0
+ ;;
+ --nocolor|-C|--quiet|-q)
+ _equery_val
+ _arguments \
+ $common_args && return 0
+ ;;
+ esac
+
+ [[ $prev2 == (--category|-c) ]] &&
+ _arguments '(-c --category)'{-c,--category}'[only search in specified category]' \
+ '(-e --earlyout)'{-e,--earlyout}'[stop when first match found]' \
+ '*:file:_files' && return 0
+
+ fi
+ common_args=(
+ {'(--nocolor)-C','(-C)--nocolor'}'[turns off colors]'
+ {'(--quiet)-q','(-q)--quiet'}'[minimal output]'
+ {'(--help)-h','(-h)--help'}'[show help]'
+ )
+ ;;
+esac
diff --git a/app-shells/zsh/files/_portage b/app-shells/zsh/files/_portage-20040730
index d61e7cf71c00..e372e15c4a98 100644
--- a/app-shells/zsh/files/_portage
+++ b/app-shells/zsh/files/_portage-20040730
@@ -1,11 +1,111 @@
-#compdef emerge
+#compdef emerge rc-update rc-status ebuild opengl-update rc
-# $Id: _portage,v 1.2 2004/01/18 17:51:04 usata Exp $
+# $Id: _portage-20040730,v 1.1 2004/08/12 19:11:59 usata Exp $
-# ZSH completion function for emerge
+# ZSH completion function for Portage
# Author: baptux <bapt@ifrance.com>
# Author: Mamoru KOMACHI <usata@gentoo.org>
+# Already 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
+}
+
+# Stuff for opengl-update (the easiest to do :) )
+
+_opengl-update () {
+ if (( CURRENT == 2 ));then
+ _values "opengl-update options" \
+ 'xfree[Use libGL.so from XFree86]' \
+ 'nvidia[Use libGL.so from the NVidia drivers.]'
+ fi
+}
+
+# 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]' \
+ '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 () {
+ 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|del|-d)
+ _arguments -s \
+ '*:scripts:_files -W /etc/init.d/'
+ ;;
+ 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 emerge
+
_emerge () {
local state
if (( CURRENT == 2 ));then
@@ -15,8 +115,16 @@ _emerge () {
elif (( CURRENT > 2 ));then
case "$words[2]" in
unmerge|-C)
- _arguments -s \
- '*:installed pkgname with versions:_portage_unmerge' "$common_args[@]" && return 0
+ if compset -P '(\\|)[><][=]'; then
+ _arguments -s \
+ '*:installed pkgname with versions:_portage_unmerge_vers' "$common_args[@]" && return 0
+ elif compset -P '(\\|)[<=>]'; then
+ _arguments -s \
+ '*:installed pkgname with versions:_portage_unmerge_vers' "$common_args[@]" && return 0
+ else
+ _arguments -s \
+ '*:installed pkgname:_portage_unmerge' "$common_args[@]" && return 0
+ fi
;;
clean|-c)
_arguments -s \
@@ -26,7 +134,12 @@ _emerge () {
_arguments -s \
'*:use package only:_portage_tbz2list' "$common_args[@]" && return 0
;;
- depclean|help|-h|info|regen|sync|rsync|--searchdesc|-S|search|-s|inject|-j|prune|-P)
+ depclean|help|-h|info|regen|sync|rsync|--searchdesc|-S|search|-s|prune|-P)
+ ;;
+ --resume|--skipfirst)
+ _arguments -s \
+ '--skipfirst[Removes the first package in the resume list]' \
+ "$common_args[@]" && return 0
;;
*)
_arguments -s \
@@ -41,24 +154,51 @@ _emerge () {
state=''
case "$lstate" in
actions)
+ if compset -P '(\\|)[><][=]'; then
+ _alternative \
+ '*:portage:_ebuild_cache'
+
+ elif compset -P '(\\|)[<=>]'; then
_alternative \
- ':emerge actions:_actions' \
- '*:portage:_portage_pkglist'
+ '*:portage:_ebuild_cache'
+
+ else
+ _alternative \
+ ':emerge actions:_actions' \
+ '*:portage:_portage_pkglist'
+ fi
+
;;
install_portage)
+ if compset -P '(\\|)[><][=]'; then
+ _alternative \
+ '*:portage:_ebuild_cache'
+ elif compset -P '(\\|)[<=>]'; then
+ _alternative \
+ '*:portage:_ebuild_cache'
+ else
_alternative \
- '*:portage:_portage_pkglist'
+ '*:portage:_portage_pkglist'
+ fi
;;
esac
done
}
-#Function to show only installed packages "cat/name-ver"
+#Function to show only installed packages -- pkgname (no category or version #)
_portage_unmerge(){
installed_portage=(/var/db/pkg/*-*/*)
- installed_dir=/var/db/pkg/
- installed_pkg=${installed_portage//$installed_dir/}
- _tags -s installed_pkg && { compadd "$@" -k installed_pkg || compadd "$@" ${(kv)=installed_pkg} }
+ installed_pkgname=${(M)${${installed_portage##*/}%%-[0-9]*}}
+ _tags -s installed_pkgname && { compadd "$@" ${(kv)=installed_pkgname} }
+ _path_files -/ -W "/var/db/pkg/"
+}
+
+#Function to show only installed packages -- cat/name-ver
+_portage_unmerge_vers(){
+ installed_portage=(/var/db/pkg/*-*/*)
+ installed_pkgname=${(M)${${installed_portage##*/}}}
+ _tags -s installed_pkgname && { compadd "$@" ${(kv)=installed_pkgname} }
+ _path_files -/ -W "/var/db/pkg/"
}
#Functions to show "cat/name", classes and dependencies
@@ -88,9 +228,36 @@ _portage_pkglist(){
#[[ -n "${portdir_overlay}" ]] && _path_files -/ -W "${portdir_overlay}"
_path_files -g \*.ebuild
}
+#Function for matching all ebuilds pkg-ver (slow if asking for all packages)
+_ebuild_cache(){
+ if _cache_invalid portage_ebuilds || ! _retrieve_cache portage_ebuilds; then
+
+ overlay_ebuilds=($portdir_overlay/*-*/*/*)
+ overlay_list=${${(M)${overlay_ebuilds##*/}#*ebuild}%%.ebuild}
+ metadata_ebuilds=($portdir/metadata/cache/*-*/*)
+ metadata_list=${(M)${${metadata_ebuilds##*/}}}
+
+ _store_cache portage_ebuilds metadata_list overlay_list
+ fi
+ _tags -s metadata_list && {compadd "$@" ${(kv)=metadata_list} }
+ _tags -s overlay_list && {compadd "$@" ${(kv)=overlay_list} }
+}
+
+local update_policy
+zstyle -s ":completion:*:*:emerge:*" cache-policy update_policy
+if [[ -z "$update_policy" ]]; then
+ zstyle ":completion:*:*:emerge:*" cache-policy _ebuilds_caching_policy
+fi
+
+_ebuilds_caching_policy () {
+ # rebuild if cache is more than a week old
+ oldp=( "$1"(mw+1) )
+ (( $#oldp )) && return 0
+}
common_args=(
- {'(-p)--pretend','(--pretend)-p'}'[simply display what would be done]'
+ {'(-p -a --ask)--pretend','(--pretend -a --ask)-p'}'[simply display what would be done]'
+ {'(-p -a --pretend)--ask','(--pretend -p --ask)-a'}'[ask what would be done]'
{'(-d)--debug','(--debug)-d'}'[Tells emerge to run the emerge command in debug mode]'
)
install_args=(
@@ -112,16 +279,10 @@ install_args=(
{'(--usepkg --changelog -l)-k','(-k --changelog -l)--usepkg'}'[Tells emerge to use binary packages if available]'
{'(--usepkgonly --changelog -l)-K','(-K --changelog -l)--usepkgonly'}'[Tells emerge to use binary packages only]'
{'(--verbose)-v','(-v)--verbose'}'[Tell emerge to run in verbose mode]'
- '(-p --pretend)--columns[Displays versions in aligned format]'
+ '(-p --pretend -a --ask)--columns[Displays versions in aligned format]'
'--resume[Resumes the last merge operation]'
- '--skipfirst[Removes the first package in the resume list]'
)
-_options() {
- _arguments -s \
- "$unmerge_args[@]" "$common_args[@]" "$install_args[@]"
-}
-
_actions() {
_values "emerge actions" \
'sync[Initiates a portage tree update]' \
@@ -168,5 +329,26 @@ fi
portage_pkglist=(${portdir}/*-*/* ${portdir_overlay}/*-*/*)
portage_pkglist=(${portage_pkglist##*/})
+gentoo_runlevels=(/etc/runlevels/*)
+gentoo_runlevels=(${${gentoo_runlevels/\/etc\/runlevels\//}%/})
-_emerge "$@"
+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
+ ;;
+esac
diff --git a/app-shells/zsh/files/digest-zsh-4.1.1-r4 b/app-shells/zsh/files/digest-zsh-4.1.1-r4
deleted file mode 100644
index f9bbd87c4098..000000000000
--- a/app-shells/zsh/files/digest-zsh-4.1.1-r4
+++ /dev/null
@@ -1,3 +0,0 @@
-MD5 48958b1a3fc86261a26eea40a4f7d4af zsh-4.1.1.tar.bz2 1924514
-MD5 a4fb455591ee95e5264bf985af3473ea zsh-4.1.1-euc-0.2.patch.gz 2788
-MD5 3ec54fa702b9a5c5209b56c2c8ed6a88 zsh-4.1.1-doc.tar.bz2 1572953
diff --git a/app-shells/zsh/files/digest-zsh-4.2.0 b/app-shells/zsh/files/digest-zsh-4.2.0
deleted file mode 100644
index 7161590156e5..000000000000
--- a/app-shells/zsh/files/digest-zsh-4.2.0
+++ /dev/null
@@ -1,2 +0,0 @@
-MD5 866bcdad8c0c4974650f5eff395a9a35 zsh-4.2.0.tar.bz2 1990884
-MD5 14aa2d8d9e6f546593fd42f45dfee669 zsh-4.2.0-doc.tar.bz2 1695230
diff --git a/app-shells/zsh/files/digest-zsh-4.2.1_alpha1 b/app-shells/zsh/files/digest-zsh-4.2.1_alpha1
new file mode 100644
index 000000000000..bbc862c1bc8c
--- /dev/null
+++ b/app-shells/zsh/files/digest-zsh-4.2.1_alpha1
@@ -0,0 +1,3 @@
+MD5 e76611901723d08637115d8a550fc650 zsh-4.2.1-test-A.tar.bz2 2036847
+MD5 3c222b6d7b974c07ba244c37eb5d65fb zsh-4.2.0-euc-0.2.patch.gz 2857
+MD5 d2b5e31c64d63c0f6acbfd9d545a9822 zsh-4.2.1-test-A-doc.tar.bz2 1752490