Skip to content

Commit 89dcaeb

Browse files
authored
Merge pull request #501 from mtorromeo/rkt
Update rkt completions
2 parents e31fcdc + 8cdf60b commit 89dcaeb

File tree

1 file changed

+88
-6
lines changed

1 file changed

+88
-6
lines changed

Diff for: src/_rkt

+88-6
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ _rkt() {
6868
cat-manifest)
6969
_arguments \
7070
'--pretty-print[apply indent to format the output]' \
71+
'--uuid-file=[read pod UUID from file instead of argument]:uuid file:_files' \
72+
'1:POD:_rkt_pods' \
7173
;;
7274

7375
config)
@@ -78,12 +80,15 @@ _rkt() {
7880
enter)
7981
_arguments \
8082
'--app=:appname' \
83+
'1:POD:_rkt_pods' \
8184
;;
8285

8386
export)
8487
_arguments \
8588
'--app=:appname' \
8689
'--overwrite[overwrite output ACI]' \
90+
'1:POD:_rkt_pods' \
91+
'2:OUTPUT_ACI_FILE:_files' \
8792
;;
8893

8994
fetch)
@@ -98,6 +103,7 @@ _rkt() {
98103
_arguments \
99104
'--grace-period=[duration to wait before discarding inactive pods from garbage]:duration' \
100105
'--expire-prepared=[duration to wait before expiring prepared pods]:duration' \
106+
'--mark-only[move to the garbage directories without actually deleting]' \
101107
;;
102108

103109
image)
@@ -120,75 +126,118 @@ _rkt() {
120126
prepare)
121127
# TODO: autocomplete stage1 images
122128
_arguments \
129+
'--caps-remove=[capability to remove]:capability' \
130+
'--caps-retain=[capability to retain]:capability' \
131+
'--cpu=[cpu limit for the preceding image]:cpu limit' \
132+
'--cpu-shares=[assign the specified CPU time share weight]:weight' \
133+
"--environment=[set the app's environment variables]:variable key=value" \
123134
'--exec=[override the exec command for the preceding image]:command' \
135+
'--group=[group override for the preceding image]:group' \
124136
'--inherit-env[inherit all environment variables not set by apps]' \
137+
'--memory=[memory limit for the preceding image]:memory' \
125138
'--mount=[mount point binding a volume to a path within an app]:mount point' \
139+
'--name=[set the name of the app]:name' \
126140
'--no-overlay[disable overlay filesystem]' \
127-
'--no-store[fetch images ignoring the local store]' \
141+
'--oom-score-adj=[oom-score-adj isolator override]:oom-score-adj' \
128142
'--pod-manifest=[the path to the pod manifest]:manifest:_files' \
129143
'--port=[ports to expose on the host]:NAME\:HOSTPORT' \
130144
'--private-users[run within user namespaces]' \
131145
'--quiet[suppress superfluous output on stdout, print only the UUID on success]' \
146+
'--readonly-rootfs=[mount rootfs read-only]:fs' \
132147
'--set-env=[an environment variable to set for apps]:NAME=VALUE' \
148+
'--set-env-file=[the path to an environment variables file]:file:_files' \
133149
'--signature=[local signature file to use in validating the preceding image]:signature:_files' \
134150
'--stage1-from-dir=[a filename of an image in stage1 images directory to use as stage1]:image' \
135151
'--stage1-hash=[a hash of an image to use as stage1]:image hash' \
136152
'--stage1-name=[a name of an image to use as stage1]:image name' \
137153
'--stage1-path=[a path to an image to use as stage1]:image path:_files' \
138154
'--stage1-url=[a URL to an image to use as stage1]:image url' \
139-
'--store-only[use only available images in the store]' \
155+
'--supplementary-gids=[supplementary group IDs override for the preceding image]:group IDs' \
156+
'--user=[user override for the preceding image]:user' \
157+
"--user-annotation=[set the app's annotations]:annotation key=value" \
158+
"--user-label=[set the app's labels]:label key=value" \
140159
'--volume=[volumes to make available in the pod]:volume' \
160+
'--working-dir=[override the working directory of the preceding image]:working directory:_files -/' \
161+
'1:IMAGE:_rkt_images' \
141162
;;
142163

143164
rm)
144165
_arguments \
145166
'--uuid-file=[read pod UUID from file instead of argument]:uuid file:_files' \
167+
'1:POD:_rkt_pods' \
146168
;;
147169

148170
run)
149171
_arguments \
172+
'--caps-remove=[capability to remove]:capability' \
173+
'--caps-retain=[capability to retain]:capability' \
150174
'--cpu=[cpu limit for the preceding image]:cpu limit' \
175+
'--cpu-shares=[assign the specified CPU time share weight]:weight' \
151176
'--dns=[name servers to write in /etc/resolv.conf]:name servers' \
177+
'--dns-domain=[DNS domain to write in]:domain' \
152178
'--dns-opt=[DNS options to write in /etc/resolv.conf]:dns options' \
153179
'--dns-search=[DNS search domains to write in /etc/resolv.conf]:search domains' \
180+
"--environment=[set the app's environment variables]:variable key=value" \
154181
'--exec=[override the exec command for the preceding image]:command' \
182+
'--group=[group override for the preceding image]:group' \
155183
"--hostname=[pod's hostname]:hostname" \
184+
"--hosts-entry=[entries to add to the pod-wide /etc/hosts. Pass 'host' to use the host's /etc/hosts]:hosts entry" \
156185
'--inherit-env[inherit all environment variables not set by apps]' \
157186
'--interactive[run pod interactively]' \
158187
'--mds-register[register pod with metadata service]' \
159188
'--memory=[memory limit for the preceding image]:memory limit' \
189+
'--mount=[mount point binding a volume to a path within an app]:mount point' \
190+
'--name=[set the name of the app]:name' \
160191
"--net=[configure the pod's networking]:networks" \
161192
'--no-overlay[disable overlay filesystem]' \
162-
'--no-store[fetch images ignoring the local store]' \
163193
'--pod-manifest=[the path to the pod manifest]:manifest:_files' \
164194
'--port=[ports to expose on the host]:NAME\:HOSTPORT' \
165195
'--private-users[run within user namespaces]' \
166196
'--set-env=[an environment variable to set for apps]:NAME=VALUE' \
197+
'--set-env-file=[the path to an environment variables file]:file:_files' \
167198
'--signature=[local signature file to use in validating the preceding image]:signature:_files' \
168199
'--stage1-from-dir=[a filename of an image in stage1 images directory to use as stage1]:image' \
169200
'--stage1-hash=[a hash of an image to use as stage1]:image hash' \
170201
'--stage1-name=[a name of an image to use as stage1]:image name' \
171202
'--stage1-path=[a path to an image to use as stage1]:image path:_files' \
172203
'--stage1-url=[a URL to an image to use as stage1]:image url' \
173-
'--store-only[use only available images in the store]' \
204+
'--supplementary-gids=[supplementary group IDs override for the preceding image]:group IDs' \
205+
'--user=[user override for the preceding image]:user' \
206+
"--user-annotation=[set the app's annotations]:annotation key=value" \
207+
"--user-label=[set the app's labels]:label key=value" \
174208
'--uuid-file-save=[write out pod UUID to specified file]:uuid file:_files' \
175209
'--volume=[volumes to make available in the pod]:volume' \
210+
'--working-dir=[override the working directory of the preceding image]:working directory:_files -/' \
211+
'1:IMAGE:_rkt_images' \
176212
;;
177213

178214
run-prepared)
179215
_arguments \
180216
'--dns=[name servers to write in /etc/resolv.conf]:name servers' \
217+
'--dns-domain=[DNS domain to write in]:domain' \
181218
'--dns-opt=[DNS options to write in /etc/resolv.conf]:dns options' \
182219
'--dns-search=[DNS search domains to write in /etc/resolv.conf]:search domains' \
183220
"--hostname=[pod's hostname]:hostname" \
221+
"--hosts-entry=[entries to add to the pod-wide /etc/hosts. Pass 'host' to use the host's /etc/hosts]:hosts entry" \
184222
'--interactive[run pod interactively]' \
185223
'--mds-register[register pod with metadata service]' \
186224
"--net=[configure the pod's networking]:networks" \
225+
'1:POD:_rkt_pods' \
187226
;;
188227

189228
status)
190229
_arguments \
191-
'--wait[toggle waiting for the pod to exit]' \
230+
'--format=[choose the output format]:format:(json json-pretty)' \
231+
'--wait[toggles waiting for the pod to exit]' \
232+
'--wait-ready[toggles waiting until the pod is ready]' \
233+
'1:POD:_rkt_pods' \
234+
;;
235+
236+
stop)
237+
_arguments \
238+
'--force[forced stopping]' \
239+
'--uuid-file=[read pod UUID from file instead of argument]:uuid file:_files' \
240+
'1:POD:_rkt_pods' \
192241
;;
193242

194243
trust)
@@ -217,6 +266,22 @@ _rkt() {
217266
cat-manifest)
218267
_arguments \
219268
'--pretty-print[apply indent to format the output]' \
269+
'1:IMAGE:_rkt_images' \
270+
;;
271+
272+
export)
273+
_arguments \
274+
'--overwrite[overwrite output ACI]' \
275+
'1:IMAGE:_rkt_images' \
276+
'2:OUTPUT_ACI_FILE:_files' \
277+
;;
278+
279+
extract|render)
280+
_arguments \
281+
'--overwrite[overwrite output ACI]' \
282+
'--rootfs-only[extract rootfs only]' \
283+
'1:IMAGE:_rkt_images' \
284+
'2:OUTPUT_DIR:_files -/' \
220285
;;
221286

222287
gc)
@@ -233,7 +298,7 @@ _rkt() {
233298

234299
rm)
235300
_arguments \
236-
':image' \
301+
'*:IMAGE:_rkt_images' \
237302
;;
238303
esac
239304
;;
@@ -258,6 +323,7 @@ _rkt_cmds() {
258323
'run:Run image(s) in a pod in rkt'
259324
'run-prepared:Run a prepared application pod in rkt'
260325
'status:Check the status of a rkt pod'
326+
'stop:Stop a pod'
261327
'trust:Trust a key for image verification'
262328
'version:Print the version and exit'
263329
'help:Help about any command'
@@ -269,13 +335,29 @@ _rkt_image_cmds() {
269335
local -a commands
270336
commands=(
271337
'cat-manifest:Inspect and print the image manifest'
338+
'export:Export a stored image to an ACI file'
339+
'extract:Extract a stored image to a directory'
272340
'gc:Garbage collect local store'
273341
'list:List images in the local store'
342+
'render:Render a stored image to a directory with all its dependencies'
274343
'rm:Remove image(s) with the given ID(s) or name(s) from the local store'
275344
)
276345
_describe 'command' commands
277346
}
278347

348+
_rkt_images() {
349+
local -a images
350+
images=($(rkt image list --fields id,name --no-legend | sed 's/\t/\n/;s/:/\\:/g' | sort | uniq))
351+
_describe 'IMAGE' images
352+
}
353+
354+
_rkt_pods() {
355+
local -a pods
356+
IFS=$'\n'
357+
pods=($(rkt list --full --no-legend | sed 's/:/\\:/g;s/\t/:/;s/\t/ /g'))
358+
_describe 'POD' pods
359+
}
360+
279361
_rkt "$@"
280362

281363
# Local Variables:

0 commit comments

Comments
 (0)