summaryrefslogtreecommitdiff
path: root/cmd/podman/play/kube.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-11-13 16:46:51 +0100
committerGitHub <noreply@github.com>2020-11-13 16:46:51 +0100
commit2993e97dec9d998d2eca7c5aee918b1429596a85 (patch)
tree9bdb3b5c766d913a8d1980ad017276e1f1a51b7c /cmd/podman/play/kube.go
parent6d9d9fee30b5982858d51a666f0c335ba47323a0 (diff)
parentae3816614de1c2a0c9ab9cd05afebc5b1dda6429 (diff)
downloadpodman-2993e97dec9d998d2eca7c5aee918b1429596a85.tar.gz
podman-2993e97dec9d998d2eca7c5aee918b1429596a85.tar.bz2
podman-2993e97dec9d998d2eca7c5aee918b1429596a85.zip
Merge pull request #6442 from Luap99/podman-autocomplete
Shell completion
Diffstat (limited to 'cmd/podman/play/kube.go')
-rw-r--r--cmd/podman/play/kube.go51
1 files changed, 39 insertions, 12 deletions
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index 4f34b2b76..a9e91bd68 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -5,7 +5,9 @@ import (
"os"
"github.com/containers/common/pkg/auth"
+ "github.com/containers/common/pkg/completion"
"github.com/containers/image/v5/types"
+ "github.com/containers/podman/v2/cmd/podman/common"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/utils"
"github.com/containers/podman/v2/pkg/domain/entities"
@@ -31,11 +33,12 @@ var (
It creates the pod and containers described in the YAML. The containers within the pod are then started and the ID of the new Pod is output.`
kubeCmd = &cobra.Command{
- Use: "kube [options] KUBEFILE",
- Short: "Play a pod based on Kubernetes YAML.",
- Long: kubeDescription,
- RunE: kube,
- Args: cobra.ExactArgs(1),
+ Use: "kube [options] KUBEFILE",
+ Short: "Play a pod based on Kubernetes YAML.",
+ Long: kubeDescription,
+ RunE: kube,
+ Args: cobra.ExactArgs(1),
+ ValidArgsFunction: completion.AutocompleteDefault,
Example: `podman play kube nginx.yml
podman play kube --creds user:password --seccomp-profile-root /custom/path apache.yml`,
}
@@ -50,17 +53,41 @@ func init() {
flags := kubeCmd.Flags()
flags.SetNormalizeFunc(utils.AliasFlags)
- flags.StringVar(&kubeOptions.CredentialsCLI, "creds", "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
- flags.StringVar(&kubeOptions.Network, "network", "", "Connect pod to CNI network(s)")
- flags.StringVar(&kubeOptions.LogDriver, "log-driver", "", "Logging driver for the container")
+
+ credsFlagName := "creds"
+ flags.StringVar(&kubeOptions.CredentialsCLI, credsFlagName, "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
+ _ = kubeCmd.RegisterFlagCompletionFunc(credsFlagName, completion.AutocompleteNone)
+
+ networkFlagName := "network"
+ flags.StringVar(&kubeOptions.Network, networkFlagName, "", "Connect pod to CNI network(s)")
+ _ = kubeCmd.RegisterFlagCompletionFunc(networkFlagName, common.AutocompleteNetworks)
+
+ logDriverFlagName := "log-driver"
+ flags.StringVar(&kubeOptions.LogDriver, logDriverFlagName, "", "Logging driver for the container")
+ _ = kubeCmd.RegisterFlagCompletionFunc(logDriverFlagName, common.AutocompleteLogDriver)
+
flags.BoolVarP(&kubeOptions.Quiet, "quiet", "q", false, "Suppress output information when pulling images")
flags.BoolVar(&kubeOptions.TLSVerifyCLI, "tls-verify", true, "Require HTTPS and verify certificates when contacting registries")
- flags.StringVar(&kubeOptions.Authfile, "authfile", auth.GetDefaultAuthFile(), "Path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override")
+
+ authfileFlagName := "authfile"
+ flags.StringVar(&kubeOptions.Authfile, authfileFlagName, auth.GetDefaultAuthFile(), "Path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override")
+ _ = kubeCmd.RegisterFlagCompletionFunc(authfileFlagName, completion.AutocompleteDefault)
+
if !registry.IsRemote() {
- flags.StringVar(&kubeOptions.CertDir, "cert-dir", "", "`Pathname` of a directory containing TLS certificates and keys")
+
+ certDirFlagName := "cert-dir"
+ flags.StringVar(&kubeOptions.CertDir, certDirFlagName, "", "`Pathname` of a directory containing TLS certificates and keys")
+ _ = kubeCmd.RegisterFlagCompletionFunc(certDirFlagName, completion.AutocompleteDefault)
+
flags.StringVar(&kubeOptions.SignaturePolicy, "signature-policy", "", "`Pathname` of signature policy file (not usually used)")
- flags.StringVar(&kubeOptions.SeccompProfileRoot, "seccomp-profile-root", defaultSeccompRoot, "Directory path for seccomp profiles")
- flags.StringSliceVar(&kubeOptions.ConfigMaps, "configmap", []string{}, "`Pathname` of a YAML file containing a kubernetes configmap")
+
+ seccompProfileRootFlagName := "seccomp-profile-root"
+ flags.StringVar(&kubeOptions.SeccompProfileRoot, seccompProfileRootFlagName, defaultSeccompRoot, "Directory path for seccomp profiles")
+ _ = kubeCmd.RegisterFlagCompletionFunc(seccompProfileRootFlagName, completion.AutocompleteDefault)
+
+ configmapFlagName := "configmap"
+ flags.StringSliceVar(&kubeOptions.ConfigMaps, configmapFlagName, []string{}, "`Pathname` of a YAML file containing a kubernetes configmap")
+ _ = kubeCmd.RegisterFlagCompletionFunc(configmapFlagName, completion.AutocompleteDefault)
}
_ = flags.MarkHidden("signature-policy")
}