From 61cb6d61dd420a000c843171b5917b5595874a67 Mon Sep 17 00:00:00 2001 From: Eduardo Vega Date: Fri, 26 Mar 2021 18:16:41 -0600 Subject: Add support for play/generate kube volumes Signed-off-by: Eduardo Vega --- cmd/podman/common/completion.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'cmd/podman/common/completion.go') 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) { -- cgit v1.2.3-54-g00ecf