summaryrefslogtreecommitdiff
path: root/cmd/podman/volumes/create.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/volumes/create.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/volumes/create.go')
-rw-r--r--cmd/podman/volumes/create.go25
1 files changed, 18 insertions, 7 deletions
diff --git a/cmd/podman/volumes/create.go b/cmd/podman/volumes/create.go
index a54530183..8de343a24 100644
--- a/cmd/podman/volumes/create.go
+++ b/cmd/podman/volumes/create.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
+ "github.com/containers/common/pkg/completion"
"github.com/containers/podman/v2/cmd/podman/parse"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/pkg/domain/entities"
@@ -15,10 +16,11 @@ var (
createDescription = `If using the default driver, "local", the volume will be created on the host in the volumes directory under container storage.`
createCommand = &cobra.Command{
- Use: "create [options] [NAME]",
- Short: "Create a new volume",
- Long: createDescription,
- RunE: create,
+ Use: "create [options] [NAME]",
+ Short: "Create a new volume",
+ Long: createDescription,
+ RunE: create,
+ ValidArgsFunction: completion.AutocompleteNone,
Example: `podman volume create myvol
podman volume create
podman volume create --label foo=bar myvol`,
@@ -40,9 +42,18 @@ func init() {
Parent: volumeCmd,
})
flags := createCommand.Flags()
- flags.StringVar(&createOpts.Driver, "driver", "local", "Specify volume driver name")
- flags.StringSliceVarP(&opts.Label, "label", "l", []string{}, "Set metadata for a volume (default [])")
- flags.StringArrayVarP(&opts.Opts, "opt", "o", []string{}, "Set driver specific options (default [])")
+
+ driverFlagName := "driver"
+ flags.StringVar(&createOpts.Driver, driverFlagName, "local", "Specify volume driver name")
+ _ = createCommand.RegisterFlagCompletionFunc(driverFlagName, completion.AutocompleteNone)
+
+ labelFlagName := "label"
+ flags.StringSliceVarP(&opts.Label, labelFlagName, "l", []string{}, "Set metadata for a volume (default [])")
+ _ = createCommand.RegisterFlagCompletionFunc(labelFlagName, completion.AutocompleteNone)
+
+ optFlagName := "opt"
+ flags.StringArrayVarP(&opts.Opts, optFlagName, "o", []string{}, "Set driver specific options (default [])")
+ _ = createCommand.RegisterFlagCompletionFunc(optFlagName, completion.AutocompleteNone)
}
func create(cmd *cobra.Command, args []string) error {