summaryrefslogtreecommitdiff
path: root/cmd/podman/images/mount.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/images/mount.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/images/mount.go')
-rw-r--r--cmd/podman/images/mount.go22
1 files changed, 14 insertions, 8 deletions
diff --git a/cmd/podman/images/mount.go b/cmd/podman/images/mount.go
index 28e9264ee..1eac59ef9 100644
--- a/cmd/podman/images/mount.go
+++ b/cmd/podman/images/mount.go
@@ -7,12 +7,12 @@ import (
"text/template"
"github.com/containers/common/pkg/report"
+ "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"
"github.com/pkg/errors"
"github.com/spf13/cobra"
- "github.com/spf13/pflag"
)
var (
@@ -24,10 +24,11 @@ var (
`
mountCommand = &cobra.Command{
- Use: "mount [options] [IMAGE...]",
- Short: "Mount an image's root filesystem",
- Long: mountDescription,
- RunE: mount,
+ Use: "mount [options] [IMAGE...]",
+ Short: "Mount an image's root filesystem",
+ Long: mountDescription,
+ RunE: mount,
+ ValidArgsFunction: common.AutocompleteImages,
Example: `podman image mount imgID
podman image mount imgID1 imgID2 imgID3
podman image mount
@@ -43,9 +44,14 @@ var (
mountOpts entities.ImageMountOptions
)
-func mountFlags(flags *pflag.FlagSet) {
+func mountFlags(cmd *cobra.Command) {
+ flags := cmd.Flags()
+
flags.BoolVarP(&mountOpts.All, "all", "a", false, "Mount all images")
- flags.StringVar(&mountOpts.Format, "format", "", "Print the mounted images in specified format (json)")
+
+ formatFlagName := "format"
+ flags.StringVar(&mountOpts.Format, formatFlagName, "", "Print the mounted images in specified format (json)")
+ _ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteJSONFormat)
}
func init() {
@@ -54,7 +60,7 @@ func init() {
Command: mountCommand,
Parent: imageCmd,
})
- mountFlags(mountCommand.Flags())
+ mountFlags(mountCommand)
}
func mount(cmd *cobra.Command, args []string) error {