summaryrefslogtreecommitdiff
path: root/cmd/podman/images/save.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-05 15:57:08 +0200
committerGitHub <noreply@github.com>2020-05-05 15:57:08 +0200
commit4a1331d0afd9a21ff9465916d4006ff7297ae07c (patch)
tree97b56fc4361ed81c84dff9e07d46abf302670f1b /cmd/podman/images/save.go
parentc313eec620becf710af925c02b7e5dfd80bd9ba6 (diff)
parent6ed3b8841f00d2aa1f86678c079a119e027b0d66 (diff)
downloadpodman-4a1331d0afd9a21ff9465916d4006ff7297ae07c.tar.gz
podman-4a1331d0afd9a21ff9465916d4006ff7297ae07c.tar.bz2
podman-4a1331d0afd9a21ff9465916d4006ff7297ae07c.zip
Merge pull request #6077 from rhatdan/v2
Fix errors found when comparing podman v1 --help versus V2
Diffstat (limited to 'cmd/podman/images/save.go')
-rw-r--r--cmd/podman/images/save.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/cmd/podman/images/save.go b/cmd/podman/images/save.go
index 8f7832074..56953e41c 100644
--- a/cmd/podman/images/save.go
+++ b/cmd/podman/images/save.go
@@ -13,6 +13,7 @@ import (
"github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
+ "github.com/spf13/pflag"
"golang.org/x/crypto/ssh/terminal"
)
@@ -43,6 +44,16 @@ var (
podman save --format docker-dir -o ubuntu-dir ubuntu
podman save > alpine-all.tar alpine:latest`,
}
+ imageSaveCommand = &cobra.Command{
+ Args: saveCommand.Args,
+ Use: saveCommand.Use,
+ Short: saveCommand.Short,
+ Long: saveCommand.Long,
+ RunE: saveCommand.RunE,
+ Example: `podman image save --quiet -o myimage.tar imageID
+ podman image save --format docker-dir -o ubuntu-dir ubuntu
+ podman image save > alpine-all.tar alpine:latest`,
+ }
)
var (
@@ -54,7 +65,17 @@ func init() {
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: saveCommand,
})
- flags := saveCommand.Flags()
+ saveFlags(saveCommand.Flags())
+
+ registry.Commands = append(registry.Commands, registry.CliCommand{
+ Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
+ Command: imageSaveCommand,
+ Parent: imageCmd,
+ })
+ saveFlags(imageSaveCommand.Flags())
+}
+
+func saveFlags(flags *pflag.FlagSet) {
flags.BoolVar(&saveOpts.Compress, "compress", false, "Compress tarball image layers when saving to a directory using the 'dir' transport. (default is same compression type as source)")
flags.StringVar(&saveOpts.Format, "format", define.V2s2Archive, "Save image to oci-archive, oci-dir (directory with oci manifest type), docker-archive, docker-dir (directory with v2s2 manifest type)")
flags.StringVarP(&saveOpts.Output, "output", "o", "", "Write to a specified file (default: stdout, which must be redirected)")