forked from zsh-users/zsh-completions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_portage_utils
189 lines (187 loc) · 9.01 KB
/
_portage_utils
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#compdef qatom qcheck qdepends qfile qgrep qcache qlist qlop qsearch qsize quse qtbz2 qpkg qxpak
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for Portage Utils (small and faster portage helper tools,
# writen in C, partially — Gentoolkit analog).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Vadim A. Misbakh-Soloviev <[email protected]>
# * Bapt <[email protected]>
# * kaworu <[email protected]>
# * David Durrleman <[email protected]>
# * oberyno <[email protected]>
# * Mamoru Komachi <[email protected]>
#
# ------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------
#<app-portage/portage-utils-0.19>
#
local common_args PORTDIR var
var=PORTDIR
[[ -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}`"
common_args=(
{'(--verbose)-v','(-v)--verbose'}'[Make a lot of noise]' \
{'(--quiet)-q','(-q)--quiet'}'[Tighter output; suppress warnings]' \
{'(--nocolor)-C','(-C)--nocolor'}'[Do not output color]' \
{'(--help)-h','(-h)--help'}'[Print this help and exit]' \
{'(--version)-V','(-V)--version'}'[Print version and exit]' \
)
case $service in
qcheck)
_arguments -s $common_args \
{'(--all)-a','(-a)--all'}'[List all packages]' \
{'(--update)-u','(-u)--update'}'[Update chksum and mtimes for packages]' \
'*:packages:_gentoo_packages installed'
;;
qdepends)
_arguments -s $common_args \
{'(--depend)-d','(-d)--depend'}'[Show DEPEND info (default)]' \
{'(--rdepend)-r','(-r)--rdepend'}'[Show RDEPEND info]' \
{'(--pdepend)-p','(-p)--pdepend'}'[Show PDEPEND info]' \
{'(--key)-k','(-k)--key'}'[User defined vdb key]' \
{'(--query)-Q','(-Q)--query'}'[Query reverse deps]' \
{'(--name-only)-N','(-N)--name-only'}'[Only show package name]' \
{'(--all)-a','(-a)--all'}'[Show all DEPEND info]' \
'*:packages:_gentoo_packages installed'
;;
qfile)
_arguments -s $common_args \
{'(--exact)-e','(-e)--exact'}'[Exact match]' \
'*:filename:_files'
;;
qgrep)
_arguments -s $common_args \
{'(--invert-match)-I','(-I)--invert-match'}'[Select non-matching lines]' \
{'(--ignore-case)-i','(-i)--ignore-case'}'[Ignore case distinctions]' \
{'(--with-filename)-H','(-H)--with-filename'}'[Print the filename for each match]' \
{'(--count)-c','(-c)--count'}'[Only print a count of matching lines per FILE]' \
{'(--regexp)-e','(-e)--regexp'}'[Use PATTERN as a regular expression]' \
'*:pattern::'
;;
qcache)
local arches allarches arch
show_archs(){
arches=(${(f)"$(<$PORTDIR/profiles/arch.list)"})
allarches=($archs)
for arch in $arches;do
allarches=($allarches $arch)
done
_describe -t available-arches "arch" allarches
}
_arguments -s $common_args \
'*:arch:show_archs'
;;
qlist)
_arguments -s $common_args \
{'(--installed)-I','(-I)--installed'}'[Just show installed packages]' \
{'(--slots)-S','(-S)--slots'}'[Display installed packages with slots]' \
{'(--umap)-U','(-U)--umap'}'[Display installed packages with flags used]' \
{'(--dups)-D','(-D)--dups'}'[Only show package dups]' \
{'(--exact)-e','(-e)--exact'}'[Exact match (only CAT/PN or PN without PV)]' \
{'(--all)-a','(-a)--all'}'[Show every installed package]' \
{'(--dir)-d','(-d)--dir'}'[Only show directories]' \
{'(--obj)-o','(-o)--obj'}'[Only show objects]' \
{'(--sym)-s','(-s)--sy'}'[Only show symlinks]' \
'*:packages:_gentoo_packages installed'
;;
qlop)
_arguments -s $common_args \
{'(--guage)-g','(-g)--guage'}'[Guage number of times a package has been merged]' \
{'(--time)-t','(-t)--time'}'[Calculate merge time for a specific package]' \
{'(--human)-H','(-H)--human'}'[Print seconds in human readable format (needs -t)]' \
{'(--list)-l','(-l)--list'}'[Show merge history]' \
{'(--unlist)-u','(-u)--unlist'}'[Show unmerge history]' \
{'(--sync)-s','(-s)--sync'}'[Show sync history]' \
{'(--current)-c','(-c)--current'}'[Show current emerging packages]' \
{'(--logfile)-f','(-f)--logfile'}'[Read emerge logfile instead of /var/log/emerge.log]:log:_files' \
'*:packages:_gentoo_packages available'
;;
qsearch)
_arguments -s $common_args \
{'(--all)-a','(-a)--all'}'[List the descriptions of every package in the cache]' \
{'(--cache)-c','(-c)--cache'}'[Use the portage cache]' \
{'(--search)-s','(-s)--search'}'[Regex search package basenames]' \
{'(--desc)-S','(-S)--desc'}'[Regex search package descriptions]' \
{'(--name-only)-N','(-N)--name-only'}'[Only show package name]' \
{'(--homepage)-H','(-H)--homepage'}'[Show homepage info]' \
'*:pattern::'
;;
qsize)
_arguments -s $common_args \
{'(--filesystem)-f','(-f)--filesystem'}'[Show size used on disk]' \
{'(--all)-a','(-a)--all'}'[Size all installed packages]' \
{'(--sum)-s','(-s)--sum'}'[Include a summary]' \
{'(--sum-only)-S','(-S)--sum-only'}'[Show just the summary]' \
{'(--megabyte)-m','(-m)--megabyte'}'[Display size in megabytes]' \
{'(--kilobyte)-k','(-k)--kilobyte'}'[Display size in kilobytes]' \
{'(--byte)-b','(-b)--byte'}'[Display size in bytes]' \
'*:packages:_gentoo_packages installed'
;;
quse)
_arguments -s $common_args \
{'(--exact)-e','(-e)--exact'}'[Show exact non regexp matching using strcmp]' \
{'(--all)-a','(-a)--all'}'[Show annoying things in IUSE]' \
{'(--keywords)-K','(-K)--keywords'}'[Use the KEYWORDS vs IUSE]' \
{'(--license)-L','(-L)--license'}'[Use the LICENSE vs IUSE]' \
{'(--describe)-D','(-D)--describe'}'[Describe the USE flag]' \
{'(--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