Add progress bar to docker load

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: fae09e25698006a190d14fe64f1576f68431fabf
Component: engine
This commit is contained in:
Lei Jitang
2016-02-03 21:31:47 -05:00
parent 21c826245f
commit 311dc4f8a6
5 changed files with 47 additions and 15 deletions

View File

@ -19,6 +19,7 @@ import (
func (cli *DockerCli) CmdLoad(args ...string) error {
cmd := Cli.Subcmd("load", nil, Cli.DockerCommands["load"].Description, true)
infile := cmd.String([]string{"i", "-input"}, "", "Read from a tar archive file, instead of STDIN")
quiet := cmd.Bool([]string{"q", "-quiet"}, false, "Suppress the load output")
cmd.Require(flag.Exact, 0)
cmd.ParseFlags(args, true)
@ -31,8 +32,10 @@ func (cli *DockerCli) CmdLoad(args ...string) error {
defer file.Close()
input = file
}
response, err := cli.client.ImageLoad(context.Background(), input, true)
if !cli.isTerminalOut {
*quiet = true
}
response, err := cli.client.ImageLoad(context.Background(), input, *quiet)
if err != nil {
return err
}