summaryrefslogtreecommitdiff
path: root/cmd/podman/images/diff.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/diff.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/diff.go')
-rw-r--r--cmd/podman/images/diff.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/cmd/podman/images/diff.go b/cmd/podman/images/diff.go
index b7722e5e5..71793c707 100644
--- a/cmd/podman/images/diff.go
+++ b/cmd/podman/images/diff.go
@@ -13,11 +13,12 @@ import (
var (
// podman container _inspect_
diffCmd = &cobra.Command{
- Use: "diff [options] IMAGE",
- Args: cobra.ExactArgs(1),
- Short: "Inspect changes to the image's file systems",
- Long: `Displays changes to the image's filesystem. The image will be compared to its parent layer.`,
- RunE: diff,
+ Use: "diff [options] IMAGE",
+ Args: cobra.ExactArgs(1),
+ Short: "Inspect changes to the image's file systems",
+ Long: `Displays changes to the image's filesystem. The image will be compared to its parent layer.`,
+ RunE: diff,
+ ValidArgsFunction: common.AutocompleteImages,
Example: `podman image diff myImage
podman image diff --format json redis:alpine`,
}
@@ -37,7 +38,10 @@ func diffFlags(flags *pflag.FlagSet) {
diffOpts = &entities.DiffOptions{}
flags.BoolVar(&diffOpts.Archive, "archive", true, "Save the diff as a tar archive")
_ = flags.MarkDeprecated("archive", "Provided for backwards compatibility, has no impact on output.")
- flags.StringVar(&diffOpts.Format, "format", "", "Change the output format")
+
+ formatFlagName := "format"
+ flags.StringVar(&diffOpts.Format, formatFlagName, "", "Change the output format")
+ _ = diffCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteJSONFormat)
}
func diff(cmd *cobra.Command, args []string) error {