summaryrefslogtreecommitdiff
path: root/cmd/podman/common/completion.go
diff options
context:
space:
mode:
authorEduardo Vega <edvegavalerio@gmail.com>2021-03-26 18:16:41 -0600
committerEduardo Vega <edvegavalerio@gmail.com>2021-04-09 14:01:13 -0600
commit61cb6d61dd420a000c843171b5917b5595874a67 (patch)
treeb56af885a529beb0ddf0386b090bc7cda5c93b49 /cmd/podman/common/completion.go
parentf143de9db6861cd8b8d6fc4e03f2826041307982 (diff)
downloadpodman-61cb6d61dd420a000c843171b5917b5595874a67.tar.gz
podman-61cb6d61dd420a000c843171b5917b5595874a67.tar.bz2
podman-61cb6d61dd420a000c843171b5917b5595874a67.zip
Add support for play/generate kube volumes
Signed-off-by: Eduardo Vega <edvegavalerio@gmail.com>
Diffstat (limited to 'cmd/podman/common/completion.go')
-rw-r--r--cmd/podman/common/completion.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go
index bc106263c..d110fb1b5 100644
--- a/cmd/podman/common/completion.go
+++ b/cmd/podman/common/completion.go
@@ -405,6 +405,20 @@ func AutocompletePodsRunning(cmd *cobra.Command, args []string, toComplete strin
return getPods(cmd, toComplete, completeDefault, "running", "degraded")
}
+// AutocompleteForKube - Autocomplete all Podman objects supported by kube generate.
+func AutocompleteForKube(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ if !validCurrentCmdLine(cmd, args, toComplete) {
+ return nil, cobra.ShellCompDirectiveNoFileComp
+ }
+ containers, _ := getContainers(cmd, toComplete, completeDefault)
+ pods, _ := getPods(cmd, toComplete, completeDefault)
+ volumes, _ := getVolumes(cmd, toComplete)
+ objs := containers
+ objs = append(objs, pods...)
+ objs = append(objs, volumes...)
+ return objs, cobra.ShellCompDirectiveNoFileComp
+}
+
// AutocompleteContainersAndPods - Autocomplete container names and pod names.
func AutocompleteContainersAndPods(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if !validCurrentCmdLine(cmd, args, toComplete) {