aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/save.go
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2019-03-14 08:47:15 -0600
committerEd Santiago <santiago@redhat.com>2019-03-14 12:15:45 -0600
commit1e124306dbd35a4cfdf3f585119a2c4441ec543d (patch)
tree64a55fc5a8f86b253b30941861c0cb9e160d0f50 /cmd/podman/save.go
parent8f82edbcb3f43e39e037327ad39f4e660e11f20e (diff)
downloadpodman-1e124306dbd35a4cfdf3f585119a2c4441ec543d.tar.gz
podman-1e124306dbd35a4cfdf3f585119a2c4441ec543d.tar.bz2
podman-1e124306dbd35a4cfdf3f585119a2c4441ec543d.zip
save-load-export: clear cli-parsing default
...in order to silence Cobra's usually-helpful "(default xxx)" message. Initialization is now done in code, by testing for empty string and setting that to /dev/std{in,out} as appropriate; make special note of load.go where there's mild duplication between a local variable and cliconfig. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'cmd/podman/save.go')
-rw-r--r--cmd/podman/save.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd/podman/save.go b/cmd/podman/save.go
index 807f8b132..c10679740 100644
--- a/cmd/podman/save.go
+++ b/cmd/podman/save.go
@@ -58,7 +58,7 @@ func init() {
flags := saveCommand.Flags()
flags.BoolVar(&saveCommand.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(&saveCommand.Format, "format", v2s2Archive, "Save image to oci-archive, oci-dir (directory with oci manifest type), docker-archive, docker-dir (directory with v2s2 manifest type)")
- flags.StringVarP(&saveCommand.Output, "output", "o", "/dev/stdout", "Write to a file instead of terminal")
+ flags.StringVarP(&saveCommand.Output, "output", "o", "", "Write to a specified file (default: stdout, which must be redirected)")
flags.BoolVarP(&saveCommand.Quiet, "quiet", "q", false, "Suppress the output")
}
@@ -79,14 +79,14 @@ func saveCmd(c *cliconfig.SaveValues) error {
return errors.Errorf("--compress can only be set when --format is either 'oci-dir' or 'docker-dir'")
}
- output := c.Output
- if output == "/dev/stdout" {
+ if len(c.Output) == 0 {
fi := os.Stdout
if logrus.IsTerminal(fi) {
return errors.Errorf("refusing to save to terminal. Use -o flag or redirect")
}
+ c.Output = "/dev/stdout"
}
- if err := parse.ValidateFileName(output); err != nil {
+ if err := parse.ValidateFileName(c.Output); err != nil {
return err
}
return runtime.SaveImage(getContext(), c)