Add option to pull images quietly

Add `--quiet` to the `docker image pull` subcommand that will not pull
the image quietly.

```
$ docker pull -q golang
Using default tag: latest
```

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester
2018-12-19 13:48:41 +01:00
parent 283d8f95c8
commit dd3407b6cc
9 changed files with 46 additions and 9 deletions
+9
View File
@@ -5,6 +5,8 @@ import (
"github.com/docker/cli/e2e/internal/fixtures"
"github.com/docker/cli/internal/test/environment"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
"gotest.tools/golden"
"gotest.tools/icmd"
"gotest.tools/skip"
@@ -32,6 +34,13 @@ func TestPullWithContentTrust(t *testing.T) {
golden.Assert(t, result.Stdout(), "pull-with-content-trust.golden")
}
func TestPullQuiet(t *testing.T) {
result := icmd.RunCommand("docker", "pull", "--quiet", fixtures.AlpineImage)
result.Assert(t, icmd.Success)
assert.Check(t, is.Equal(result.Stdout(), "registry:5000/alpine:3.6\n"))
assert.Check(t, is.Equal(result.Stderr(), ""))
}
func TestPullWithContentTrustUsesCacheWhenNotaryUnavailable(t *testing.T) {
skip.If(t, environment.RemoteDaemon())
+1
View File
@@ -2,3 +2,4 @@ Pull (1 of 1): registry:5000/trust-pull:latest@sha256:641b95ddb2ea9dc2af1a0113b6
sha256:641b95ddb2ea9dc2af1a0113b6b348ebc20872ba615204fbe12148e98fd6f23d: Pulling from trust-pull
Digest: sha256:641b95ddb2ea9dc2af1a0113b6b348ebc20872ba615204fbe12148e98fd6f23d
Status: Downloaded newer image for registry:5000/trust-pull@sha256:641b95ddb2ea9dc2af1a0113b6b348ebc20872ba615204fbe12148e98fd6f23d
registry:5000/trust-pull:latest