aboutsummaryrefslogtreecommitdiffstats
path: root/src/_rkt
diff options
context:
space:
mode:
authorMassimiliano Torromeo <massimiliano.torromeo@gmail.com>2017-05-07 22:12:08 +0200
committerMassimiliano Torromeo <massimiliano.torromeo@gmail.com>2017-05-07 22:15:24 +0200
commitf9d7d9de78e368f346c91b769daeb7b8f027f4d1 (patch)
tree0ae573e2113f43bc05c4be5fa7e36b84fca49037 /src/_rkt
parentMerge pull request #496 from patrick96/gist-read (diff)
downloadzsh-completions-f9d7d9de78e368f346c91b769daeb7b8f027f4d1.tar
zsh-completions-f9d7d9de78e368f346c91b769daeb7b8f027f4d1.tar.gz
zsh-completions-f9d7d9de78e368f346c91b769daeb7b8f027f4d1.tar.bz2
zsh-completions-f9d7d9de78e368f346c91b769daeb7b8f027f4d1.tar.lz
zsh-completions-f9d7d9de78e368f346c91b769daeb7b8f027f4d1.tar.xz
zsh-completions-f9d7d9de78e368f346c91b769daeb7b8f027f4d1.tar.zst
zsh-completions-f9d7d9de78e368f346c91b769daeb7b8f027f4d1.zip
Implemented autocompletion for rkt pods and images (Fixes #465)
Diffstat (limited to 'src/_rkt')
-rw-r--r--src/_rkt26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/_rkt b/src/_rkt
index dd5c442..3ead25d 100644
--- a/src/_rkt
+++ b/src/_rkt
@@ -68,6 +68,8 @@ _rkt() {
cat-manifest)
_arguments \
'--pretty-print[apply indent to format the output]' \
+ '--uuid-file=[read pod UUID from file instead of argument]:uuid file:_files' \
+ '1:POD:_rkt_pods' \
;;
config)
@@ -78,12 +80,15 @@ _rkt() {
enter)
_arguments \
'--app=:appname' \
+ '1:POD:_rkt_pods' \
;;
export)
_arguments \
'--app=:appname' \
'--overwrite[overwrite output ACI]' \
+ '1:POD:_rkt_pods' \
+ '2:OUTPUT_ACI_FILE:_files' \
;;
fetch)
@@ -138,11 +143,13 @@ _rkt() {
'--stage1-url=[a URL to an image to use as stage1]:image url' \
'--store-only[use only available images in the store]' \
'--volume=[volumes to make available in the pod]:volume' \
+ '1:IMAGE:_rkt_images' \
;;
rm)
_arguments \
'--uuid-file=[read pod UUID from file instead of argument]:uuid file:_files' \
+ '1:POD:_rkt_pods' \
;;
run)
@@ -173,6 +180,7 @@ _rkt() {
'--store-only[use only available images in the store]' \
'--uuid-file-save=[write out pod UUID to specified file]:uuid file:_files' \
'--volume=[volumes to make available in the pod]:volume' \
+ '1:IMAGE:_rkt_images' \
;;
run-prepared)
@@ -184,11 +192,13 @@ _rkt() {
'--interactive[run pod interactively]' \
'--mds-register[register pod with metadata service]' \
"--net=[configure the pod's networking]:networks" \
+ '1:POD:_rkt_pods' \
;;
status)
_arguments \
'--wait[toggle waiting for the pod to exit]' \
+ '1:POD:_rkt_pods' \
;;
trust)
@@ -217,6 +227,7 @@ _rkt() {
cat-manifest)
_arguments \
'--pretty-print[apply indent to format the output]' \
+ '1:IMAGE:_rkt_images' \
;;
gc)
@@ -233,7 +244,7 @@ _rkt() {
rm)
_arguments \
- ':image' \
+ '*:IMAGE:_rkt_images' \
;;
esac
;;
@@ -276,6 +287,19 @@ _rkt_image_cmds() {
_describe 'command' commands
}
+_rkt_images() {
+ local -a images
+ images=($(rkt image list --fields id,name --no-legend | sed 's/\t/\n/;s/:/\\:/g' | sort | uniq))
+ _describe 'IMAGE' images
+}
+
+_rkt_pods() {
+ local -a pods
+ IFS=$'\n'
+ pods=($(rkt list --full --no-legend | sed 's/:/\\:/g;s/\t/:/;s/\t/ /g'))
+ _describe 'POD' pods
+}
+
_rkt "$@"
# Local Variables: