summaryrefslogtreecommitdiff
path: root/cmd/podman/containers/runlabel.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/containers/runlabel.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/containers/runlabel.go')
-rw-r--r--cmd/podman/containers/runlabel.go35
1 files changed, 26 insertions, 9 deletions
diff --git a/cmd/podman/containers/runlabel.go b/cmd/podman/containers/runlabel.go
index 92581c26f..2f6d2eb05 100644
--- a/cmd/podman/containers/runlabel.go
+++ b/cmd/podman/containers/runlabel.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/pkg/domain/entities"
"github.com/sirupsen/logrus"
@@ -23,11 +25,12 @@ var (
runlabelOptions = runlabelOptionsWrapper{}
runlabelDescription = "Executes a command as described by a container image label."
runlabelCommand = &cobra.Command{
- Use: "runlabel [options] LABEL IMAGE [ARG...]",
- Short: "Execute the command described by an image label",
- Long: runlabelDescription,
- RunE: runlabel,
- Args: cobra.MinimumNArgs(2),
+ Use: "runlabel [options] LABEL IMAGE [ARG...]",
+ Short: "Execute the command described by an image label",
+ Long: runlabelDescription,
+ RunE: runlabel,
+ Args: cobra.MinimumNArgs(2),
+ ValidArgsFunction: common.AutocompleteImages,
Example: `podman container runlabel run imageID
podman container runlabel install imageID arg1 arg2
podman container runlabel --display run myImage`,
@@ -42,11 +45,25 @@ func init() {
})
flags := runlabelCommand.Flags()
- flags.StringVar(&runlabelOptions.Authfile, "authfile", auth.GetDefaultAuthFile(), "Path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override")
- flags.StringVar(&runlabelOptions.CertDir, "cert-dir", "", "`Pathname` of a directory containing TLS certificates and keys")
- flags.StringVar(&runlabelOptions.Credentials, "creds", "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
+
+ authfileflagName := "authfile"
+ flags.StringVar(&runlabelOptions.Authfile, authfileflagName, auth.GetDefaultAuthFile(), "Path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override")
+ _ = runlabelCommand.RegisterFlagCompletionFunc(authfileflagName, completion.AutocompleteDefault)
+
+ certDirFlagName := "cert-dir"
+ flags.StringVar(&runlabelOptions.CertDir, certDirFlagName, "", "`Pathname` of a directory containing TLS certificates and keys")
+ _ = runlabelCommand.RegisterFlagCompletionFunc(certDirFlagName, completion.AutocompleteDefault)
+
+ credsFlagName := "creds"
+ flags.StringVar(&runlabelOptions.Credentials, credsFlagName, "", "`Credentials` (USERNAME:PASSWORD) to use for authenticating to a registry")
+ _ = runlabelCommand.RegisterFlagCompletionFunc(credsFlagName, completion.AutocompleteNone)
+
flags.BoolVar(&runlabelOptions.Display, "display", false, "Preview the command that the label would run")
- flags.StringVarP(&runlabelOptions.Name, "name", "n", "", "Assign a name to the container")
+
+ nameFlagName := "name"
+ flags.StringVarP(&runlabelOptions.Name, nameFlagName, "n", "", "Assign a name to the container")
+ _ = runlabelCommand.RegisterFlagCompletionFunc(nameFlagName, completion.AutocompleteNone)
+
flags.StringVar(&runlabelOptions.Optional1, "opt1", "", "Optional parameter to pass for install")
flags.StringVar(&runlabelOptions.Optional2, "opt2", "", "Optional parameter to pass for install")
flags.StringVar(&runlabelOptions.Optional3, "opt3", "", "Optional parameter to pass for install")