mirror of https://github.com/docker/cli.git
chore: remove backticks and resolve linting issues
Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
This commit is contained in:
parent
7c722c08d0
commit
910d5d0247
|
@ -74,7 +74,7 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
|
||||||
return 0, "", err
|
return 0, "", err
|
||||||
}
|
}
|
||||||
if !r {
|
if !r {
|
||||||
return 0, "", errdefs.Cancelled(errors.New("`builder prune` has been cancelled"))
|
return 0, "", errdefs.Cancelled(errors.New("builder prune has been cancelled"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
|
||||||
return 0, "", err
|
return 0, "", err
|
||||||
}
|
}
|
||||||
if !r {
|
if !r {
|
||||||
return 0, "", errdefs.Cancelled(errors.New("`container prune` has been cancelled"))
|
return 0, "", errdefs.Cancelled(errors.New("container prune has been cancelled"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
|
||||||
return 0, "", err
|
return 0, "", err
|
||||||
}
|
}
|
||||||
if !r {
|
if !r {
|
||||||
return 0, "", errdefs.Cancelled(errors.New("`image prune` has been cancelled"))
|
return 0, "", errdefs.Cancelled(errors.New("image prune has been cancelled"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if !r {
|
if !r {
|
||||||
return "", errdefs.Cancelled(errors.New("`network prune` cancelled has been cancelled"))
|
return "", errdefs.Cancelled(errors.New("network prune cancelled has been cancelled"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ func runUpgrade(ctx context.Context, dockerCli command.Cli, opts pluginOptions)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !r {
|
if !r {
|
||||||
return errdefs.Cancelled(errors.New("`plugin upgrade` has been cancelled"))
|
return errdefs.Cancelled(errors.New("plugin upgrade has been cancelled"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !r {
|
if !r {
|
||||||
return errdefs.Cancelled(errors.New("`system prune` has been cancelled"))
|
return errdefs.Cancelled(errors.New("system prune has been cancelled"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pruneFuncs := []func(ctx context.Context, dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error){
|
pruneFuncs := []func(ctx context.Context, dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error){
|
||||||
|
|
|
@ -17,7 +17,7 @@ func TestPrunePromptPre131DoesNotIncludeBuildCache(t *testing.T) {
|
||||||
cli := test.NewFakeCli(&fakeClient{version: "1.30"})
|
cli := test.NewFakeCli(&fakeClient{version: "1.30"})
|
||||||
cmd := newPruneCommand(cli)
|
cmd := newPruneCommand(cli)
|
||||||
cmd.SetArgs([]string{})
|
cmd.SetArgs([]string{})
|
||||||
assert.ErrorContains(t, cmd.Execute(), "`system prune` has been cancelled")
|
assert.ErrorContains(t, cmd.Execute(), "system prune has been cancelled")
|
||||||
expected := `WARNING! This will remove:
|
expected := `WARNING! This will remove:
|
||||||
- all stopped containers
|
- all stopped containers
|
||||||
- all networks not used by at least one container
|
- all networks not used by at least one container
|
||||||
|
@ -35,7 +35,7 @@ func TestPrunePromptFilters(t *testing.T) {
|
||||||
cmd := newPruneCommand(cli)
|
cmd := newPruneCommand(cli)
|
||||||
cmd.SetArgs([]string{"--filter", "until=24h", "--filter", "label=hello-world", "--filter", "label!=foo=bar", "--filter", "label=bar=baz"})
|
cmd.SetArgs([]string{"--filter", "until=24h", "--filter", "label=hello-world", "--filter", "label!=foo=bar", "--filter", "label=bar=baz"})
|
||||||
|
|
||||||
assert.ErrorContains(t, cmd.Execute(), "`system prune` has been cancelled")
|
assert.ErrorContains(t, cmd.Execute(), "system prune has been cancelled")
|
||||||
expected := `WARNING! This will remove:
|
expected := `WARNING! This will remove:
|
||||||
- all stopped containers
|
- all stopped containers
|
||||||
- all networks not used by at least one container
|
- all networks not used by at least one container
|
||||||
|
|
|
@ -49,7 +49,7 @@ func revokeTrust(ctx context.Context, dockerCLI command.Cli, remote string, opti
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !deleteRemote {
|
if !deleteRemote {
|
||||||
return errdefs.Cancelled(errors.New("`trust revoke` has been cancelled"))
|
return errdefs.Cancelled(errors.New("trust revoke has been cancelled"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ func TestTrustRevokeCommandErrors(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTrustRevokeCommand(t *testing.T) {
|
func TestTrustRevokeCommand(t *testing.T) {
|
||||||
revokeCancelledError := "`trust revoke` has been cancelled"
|
revokeCancelledError := "trust revoke has been cancelled"
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
doc string
|
doc string
|
||||||
|
|
|
@ -123,7 +123,7 @@ func PromptForConfirmation(ctx context.Context, ins io.Reader, outs io.Writer, m
|
||||||
select {
|
select {
|
||||||
case <-notifyCtx.Done():
|
case <-notifyCtx.Done():
|
||||||
// print a newline on termination
|
// print a newline on termination
|
||||||
fmt.Fprintln(outs, "")
|
_, _ = fmt.Fprintln(outs, "")
|
||||||
return false, ErrPromptTerminated
|
return false, ErrPromptTerminated
|
||||||
case r := <-result:
|
case r := <-result:
|
||||||
return r, nil
|
return r, nil
|
||||||
|
|
|
@ -82,7 +82,7 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
|
||||||
return 0, "", err
|
return 0, "", err
|
||||||
}
|
}
|
||||||
if !r {
|
if !r {
|
||||||
return 0, "", errdefs.Cancelled(errors.New("`volume prune` has been cancelled"))
|
return 0, "", errdefs.Cancelled(errors.New("volume prune has been cancelled"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ func TestVolumePrunePromptNo(t *testing.T) {
|
||||||
cli.SetIn(streams.NewIn(io.NopCloser(strings.NewReader(input))))
|
cli.SetIn(streams.NewIn(io.NopCloser(strings.NewReader(input))))
|
||||||
cmd := NewPruneCommand(cli)
|
cmd := NewPruneCommand(cli)
|
||||||
cmd.SetArgs([]string{})
|
cmd.SetArgs([]string{})
|
||||||
assert.ErrorContains(t, cmd.Execute(), "`volume prune` has been cancelled")
|
assert.ErrorContains(t, cmd.Execute(), "volume prune has been cancelled")
|
||||||
golden.Assert(t, cli.OutBuffer().String(), "volume-prune-no.golden")
|
golden.Assert(t, cli.OutBuffer().String(), "volume-prune-no.golden")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue