diff options
| author | Ed Santiago <santiago@redhat.com> | 2019-03-14 08:47:15 -0600 | 
|---|---|---|
| committer | Ed Santiago <santiago@redhat.com> | 2019-03-14 12:15:45 -0600 | 
| commit | 1e124306dbd35a4cfdf3f585119a2c4441ec543d (patch) | |
| tree | 64a55fc5a8f86b253b30941861c0cb9e160d0f50 /cmd/podman/export.go | |
| parent | 8f82edbcb3f43e39e037327ad39f4e660e11f20e (diff) | |
| download | podman-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/export.go')
| -rw-r--r-- | cmd/podman/export.go | 7 | 
1 files changed, 4 insertions, 3 deletions
| diff --git a/cmd/podman/export.go b/cmd/podman/export.go index 881215e88..92633facd 100644 --- a/cmd/podman/export.go +++ b/cmd/podman/export.go @@ -36,7 +36,7 @@ func init() {  	exportCommand.SetHelpTemplate(HelpTemplate())  	exportCommand.SetUsageTemplate(UsageTemplate())  	flags := exportCommand.Flags() -	flags.StringVarP(&exportCommand.Output, "output", "o", "/dev/stdout", "Write to a file instead of terminal") +	flags.StringVarP(&exportCommand.Output, "output", "o", "", "Write to a specified file (default: stdout, which must be redirected)")  }  // exportCmd saves a container to a tarball on disk @@ -60,15 +60,16 @@ func exportCmd(c *cliconfig.ExportValues) error {  	}  	output := c.Output -	if runtime.Remote && (output == "/dev/stdout" || len(output) == 0) { +	if runtime.Remote && len(output) == 0 {  		return errors.New("remote client usage must specify an output file (-o)")  	} -	if output == "/dev/stdout" { +	if len(output) == 0 {  		file := os.Stdout  		if logrus.IsTerminal(file) {  			return errors.Errorf("refusing to export to terminal. Use -o flag or redirect")  		} +		output = "/dev/stdout"  	}  	if err := parse.ValidateFileName(output); err != nil { | 
