-
Notifications
You must be signed in to change notification settings - Fork 4
/
zsh-completions
146 lines (134 loc) · 4.93 KB
/
zsh-completions
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
#compdef poudriere
_poudriere_jail() {
_values "poudriere jails" ${${(f)"$(${service} jails -lq)"}%% *}
}
_poudriere_pt() {
_values "poudriere portstrees" ${${(f)"$(${service} ports -lq)"}%% *}
}
# shamelessely stolen from
# /usr/local/share/zsh/4.3.12/functions/Completion/BSD/_portmaster
_poudriere_ports() {
local ret=1 _fbsd_ports _fbsd_cat
_fbsd_cat=(${PORTSDIR:-/usr/local/poudriere/ports/default/ports}/[a-z]*(/:t))
if [[ $PREFIX != */* ]] ; then
_wanted cat_packages expl 'category/ports' compadd -S '/' $_fbsd_cat
else
compset -P '*/'
_fbsd_ports=(${PORTSDIR:-/usr/local/poudriere/ports/default/ports}/$IPREFIX/*(/:t))
_wanted cat_packages expl 'category/ports' compadd $_fbsd_ports
fi
return ret
}
_bulk=(
'-a[Build all ports in the tree]'
'-f[Give the list of ports to build]:name of file:_files'
'-c[Clean the previous built binary packages]'
'-C[Clean previous packages for the given list to build]'
'-t[Add some testings to package building]'
'-s[Skip sanity]'
'-j[Run only on the given jail]::jail name:_poudriere_jail'
'-p[Specify on which ports tree the bulk will be done]::tree:_poudriere_pt'
'-J[Specify the number of jobs you want to run in parallel]::'
'-v[Be verbose; show more information. Specify twice to enable debug output.]'
'-z[Specify on which SET to use]::'
)
_jail=(
'(-d -l -s -k -u -i)-c[create a jail]'
'(-c -l -s -k -u -i)-d[delete a jail]'
'(-c -d -s -k -u -i)-l[list all available jails]'
'(-c -d -l -k -u -i)-s[start a jail]'
'(-c -d -i -s -u -i)-k[kill (stop) a jail]'
'(-c -d -l -s -k -i)-u[update a jail]'
'(-c -d -l -s -k -u)-i[show information about a jail]'
'-q[quiet (remove the header in list)]::' \
'-j[Specifies the jailname]::jailname:_poudriere_jail' \
'-v[Specifies which version of FreeBSD we want in jail]::version' \
'-a[Indicates architecture of the jail: i386 or amd64(same as host by default)]::arch:(amd64 i386)' \
'-m[Method used to create jail, specify NONE if you want to use your home made jail(ftp by default)]::method:((ftp svn svn+http svn+ssh csup))' \
'-f[FS name (tank/jails/myjail)]::fs:_files -/' \
'-t[version to upgrade to]' \
'-M[mountpoint]::mountpoint:_files -/'
)
_options=(
'-c[Use config target]::'
'-C[Use config-conditional target]::'
'-f[Give the list of ports to configure]:name of file:_files'
'-j[run only inside the given jail]::name:_poudriere_jail'
'-n[do not be recursive]::'
'-p[specify on which portstree we work]::tree:_poudriere_pt'
'-s[show options instead of configuring them]::'
'-r[remove options instead of configuring them]::'
'-z[Specify on which SET to use]::'
)
_distclean=(
'-J[Specify the number of jobs you want to run in parallel]::'
'-n[dry run, only show what would be done]::'
'-p[specify on which portstree we work]::tree:_poudriere_pt'
'-v[Be verbose; show more information. Specify twice to enable debug output.]'
'-y[assume yes and do not confirm before deleting]::'
)
_testport=(
'(-o)-d[specify on which port we work]::path:_files -/'
'(-d)-o[specify an origin in the portstree]:origin:_poudriere_ports'
'-c[run make config for the given port]::'
'-j[run only inside the given jail]::name:_poudriere_jail'
'-n[no custom prefix]::'
'-p[specify on which portstree we work]::tree:_poudriere_pt'
'-v[Be verbose; show more information. Specify twice to enable debug output.]'
'-z[Specify on which SET to use]::'
)
_ports=(
'(-d -u -l)-c[create a portstree]'
'(-c -u -l)-d[delete a portstree]'
'(-c -d -l)-u[update a portstree]'
'(-c -d -u)-l[lists all available portstrees]'
'-q[quiet (remove the header in list)]'
'-F[when used with -c, only create the needed ZFS filesystems and directories, but do not populate them]'
'-p[specify the name of the portstree we work on]::tree:_poudriere_pt'
'-f[FS name (tank/jails/myjail)]::fs:_files -/'
'-M[mountpoint]::mountpoint:_files -/'
'-m[method]::method:((portsnap svn svn+http svn+ssh git))'
)
_poudriere () {
local cmds
local context state line
typeset -A val_args
cmds=(
'bulk:generate packages for given ports'
'cron:run poudriere from the crontab'
'jail:manage the jails used by poudriere'
'distclean:clean old distfiles'
'options:allows to configure the options for a given port'
'ports:create, update or delete the portstrees used by poudriere'
'queue:queue a build request (through cron)'
'testport:launch a test on a given port'
'version:show poudriere version'
)
# we are in second argument
if ((CURRENT == 2)); then
_describe "poudriere main commands" cmds
# the main command has been typed, now we take care of the action
elif ((CURRENT >= 3)); then
case $words[2] in
bulk)
_arguments : $_bulk "::" && return
;;
jail)
_arguments : $_jail "::" && return
;;
distclean)
_arguments : $_distclean "::" && return
;;
options)
_arguments : $_options "::" && return
;;
ports)
_arguments : $_ports "::" && return
;;
testport)
_arguments : $_testport "::" && return
;;
esac
fi
}
_poudriere "$@"