|
|
_tags overlay && { compadd "$@" ${(kv)=overlay} } | _tags overlay && { compadd "$@" ${(kv)=overlay} } |
} | } |
| |
#moved out of equery |
_packages(){ |
_equery_val(){ |
if compset -P '(\\|)(>=|<=|<|>|=)' ; then |
_values "equery actions" \ |
_gentoo_packages ${*/(#m)(installed|available)/${MATCH}_versions} |
'files[list files owned by pkg]' \ |
else |
'list[list all packages matching pattern]' \ |
_gentoo_packages $* |
'belongs[list all packages owning file]' \ |
fi |
'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]' |
|
} |
|
| |
case $service in | case $service in |
| |
|
|
"(- :)"{--help,-h}"[show help]" \ | "(- :)"{--help,-h}"[show help]" \ |
"(--info -i --query-deps -q --slot -s)1:package:_gentoo_packages installed_versions" | "(--info -i --query-deps -q --slot -s)1:package:_gentoo_packages installed_versions" |
;; | ;; |
|
|
equery) |
|
local prev="$words[CURRENT-1]" prev2="$words[CURRENT-2]" |
|
| |
if (( CURRENT == 2 ));then |
equery) |
_equery_val |
# Based off of X/_xauth. |
_arguments \ |
local state context line expl ret=1 |
$common_args && return 0 |
local tmp cmd start_args common_args |
elif (( CURRENT > 2 ));then |
|
|
start_args=( |
case "$prev" in |
{'(--nocolor)-C','(-C)--nocolor'}'[turns off colors]' |
files|--timestamp|--md5sum|--type) |
{'(--quiet)-q','(-q)--quiet'}'[minimal output]' |
_arguments -s \ |
{'(--help)-h','(-h)--help'}'[show help]' |
|
) |
|
|
|
common_args=( |
|
'(-i --installed -I --exclude-installed)'{-i,--installed}'[search installed packages]' |
|
'(-I --exclude-installed -i --installed)'{-I,--exclude-installed}'[do not search installed packages]' |
|
'(-p --portage)'{-p,--portage-tree}'[also search in portage tree]' |
|
'(-o --overlay-tree)'{-o,--overlay-tree}'[also search in overlay tree]' |
|
) |
|
|
|
|
|
_arguments -s $start_args \ |
|
'*::command:->command' && ret=0 |
|
|
|
while [[ -n "$state" ]]; do |
|
tmp="$state" |
|
state= |
|
case "$tmp" in |
|
command) |
|
if (( CURRENT == 1 )); then |
|
state=subcommands |
|
else |
|
cmd="$words[1]" |
|
curcontext="${curcontext%:*:*}:equery-${cmd}:" |
|
case "$cmd" in |
|
belongs|b) |
|
_arguments \ |
|
'(-c --category)'{-c,--category}'[only search in specified category]:category:_gentoo_packages category' \ |
|
'(-e --earlyout)'{-e,--earlyout}'[stop when first match found]' \ |
|
'(-f --full-regex)'{-f,--full-regex}'[supplied query is a full regex]:pattern:' \ |
|
'*:file:_files' && ret=0 |
|
;; |
|
check|k) |
|
_arguments \ |
|
':portage:_packages installed' && ret=0 |
|
;; |
|
depends|d) |
|
_arguments \ |
|
'(-a --all-packages)'{-a,--all-packages}'[search in all available packages (slow)]:all packages:->packages' \ |
|
'(-d --direct -D --indirect)'{-d,--direct}'[search direct dependencies only (default)]' \ |
|
'(-d --direct -D --indirect)'{-D,--indirect}'[search indirect dependencies (VERY slow)]' \ |
|
'*:package:_packages installed' && ret=0 |
|
;; |
|
depgraph|g) |
|
_arguments \ |
|
'(-U --no-useflags)'{-U,--no-useflags}'[do not show USE flags]' \ |
|
'(-l --linear)'{-l,--linear}'[do not use fancy formatting]' \ |
|
':package:_packages installed' && ret=0 |
|
;; |
|
files|f) |
|
_arguments \ |
'--timestamp[append timestamp]' \ | '--timestamp[append timestamp]' \ |
'--md5sum[append md5sum]' \ | '--md5sum[append md5sum]' \ |
'--type[prepend file type]' \ | '--type[prepend file type]' \ |
'*:installed pkgname:_gentoo_packages installed_versions' && return 0 |
'--filter=[filter output]:filter(s):_values -s , '' dir obj sym dev fifo path conf cmd doc man info' \ |
|
':installed pkgname:_packages installed' && ret=0 |
;; | ;; |
belongs|--earlyout) |
hasuse|h) |
_arguments -s \ |
_arguments \ |
'(-c --category)'{-c,--category}'[only search in specified category]' \ |
$common_args \ |
'(-e --earlyout)'{-e,--earlyout}'[stop when first match found]' \ |
':useflag:_gentoo_packages useflag' && ret=0 |
'*:file:_files' && return 0 |
;; |
|
list|l) |
|
_arguments \ |
|
$common_args \ |
|
': :_guard "^--*" pattern' && ret=0 |
|
;; |
|
size|s) |
|
_arguments \ |
|
'(-b --bytes)'{-b,--bytes}'[report size in bytes]' \ |
|
':package:_packages installed' && ret=0 |
|
;; |
|
which|w) |
|
_arguments \ |
|
':portage:_packages available' && ret=0 |
;; | ;; |
--category|-c) |
uses|u) |
_arguments -s \ |
|
'*:category:_gentoo_packages 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:_gentoo_packages installed_versions' && return 0 |
|
;; |
|
uses|which) |
|
_arguments \ |
|
'*:package:_gentoo_packages installed_versions' \ |
|
&& 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:_gentoo_packages installed_versions' \ |
|
&& return 0 |
|
;; |
|
size|-b|--bytes) |
|
_arguments -s \ |
|
'(-b --bytes)'{-b,--bytes}'[report size in bytes]' \ |
|
'*:package:_gentoo_packages installed_versions' \ |
|
&& return 0 |
|
;; |
|
check) |
|
_arguments -s \ |
|
'*:package:_gentoo_packages installed_versions' \ |
|
&& return 0 |
|
;; |
|
--nocolor|-C|--quiet|-q) |
|
_equery_val |
|
_arguments \ | _arguments \ |
$common_args && return 0 |
{--all,-a}'[include non-installed packages]' \ |
|
":portage:_packages installed" && ret=0 |
|
;; |
|
*) |
|
_message 'command not found' |
|
;; |
|
esac |
|
fi |
;; | ;; |
esac |
subcommands) |
|
tmp=( |
[[ $prev2 == (--category|-c) ]] && |
{belongs,b}'[list all packages owning file(s)]' |
_arguments '(-c --category)'{-c,--category}'[only search in specified category]' \ |
{check,k}'[check MD5sums and timestamps of package]' |
'(-e --earlyout)'{-e,--earlyout}'[stop when first match found]' \ |
{depends,d}'[list all packages depending on specified package]' |
'*:file:_files' && return 0 |
{depgraph,g}'[display a dependency tree for package]' |
|
{files,f}'[list files owned by package]' |
fi |
{hasuse,h}'[list all packages with specified useflag]' |
common_args=( |
{list,l}'[list all packages matching pattern]' |
{'(--nocolor)-C','(-C)--nocolor'}'[turns off colors]' |
{size,s}'[print size of files contained in package]' |
{'(--quiet)-q','(-q)--quiet'}'[minimal output]' |
{uses,u}'[display USE flags for package]' |
{'(--help)-h','(-h)--help'}'[show help]' |
{which,w}'[print full path to ebuild for package]' |
) |
) |
;; |
_values 'equery command' $tmp && ret=0 |
|
;; |
|
esac |
|
done |
|
;; |
esac | esac |