diff options
author | baude <bbaude@redhat.com> | 2018-03-06 10:42:13 -0600 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-03-07 20:59:11 +0000 |
commit | 4344639508ccd16041d1ec7fd531b6427f930374 (patch) | |
tree | 4b28256bae65377bdf4f4900461f3f5379869bf1 /cmd/podman/import.go | |
parent | f57b7bbf43fe7fc7ada8055911c7ac55e53fa698 (diff) | |
download | podman-4344639508ccd16041d1ec7fd531b6427f930374.tar.gz podman-4344639508ccd16041d1ec7fd531b6427f930374.tar.bz2 podman-4344639508ccd16041d1ec7fd531b6427f930374.zip |
podman import, load, and commit are too verbose
The progress should not be show for import, load, and commit. It makes machine
parsing of the output much more difficult. Also, each command should output an
image ID or name for the user.
Added a --verbose flag for users that still want to see progress.
Resolves issue #450
Signed-off-by: baude <bbaude@redhat.com>
Closes: #456
Approved by: rhatdan
Diffstat (limited to 'cmd/podman/import.go')
-rw-r--r-- | cmd/podman/import.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/cmd/podman/import.go b/cmd/podman/import.go index 7b380b500..d3c497d9d 100644 --- a/cmd/podman/import.go +++ b/cmd/podman/import.go @@ -25,6 +25,10 @@ var ( Name: "message, m", Usage: "Set commit message for imported image", }, + cli.BoolFlag{ + Name: "quiet, q", + Usage: "Suppress output", + }, } importDescription = `Create a container image from the contents of the specified tarball (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz). Note remote tar balls can be specified, via web address. @@ -84,6 +88,11 @@ func importCmd(c *cli.Context) error { } opts.ImageConfig = config + opts.Writer = nil + + if !c.Bool("quiet") { + opts.Writer = os.Stderr + } // if source is a url, download it and save to a temp file u, err := url.ParseRequestURI(source) @@ -96,7 +105,11 @@ func importCmd(c *cli.Context) error { source = file } - return runtime.ImportImage(source, opts) + img, err := runtime.ImportImage(source, opts) + if err == nil { + fmt.Println(img.ID) + } + return err } // donwloadFromURL downloads an image in the format "https:/example.com/myimage.tar" |