diff --git a/cli/command/cli.go b/cli/command/cli.go index f3012abe3e16..49f12a37b1c6 100644 --- a/cli/command/cli.go +++ b/cli/command/cli.go @@ -44,7 +44,6 @@ type Cli interface { Client() client.APIClient Streams SetIn(in *streams.In) - Apply(ops ...CLIOption) error config.Provider ServerInfo() ServerInfo CurrentVersion() string @@ -567,18 +566,6 @@ func (cli *DockerCli) initialize() error { return cli.initErr } -// Apply all the operation on the cli -// -// Deprecated: this method is no longer used and will be removed in the next release if there are no remaining users. -func (cli *DockerCli) Apply(ops ...CLIOption) error { - for _, op := range ops { - if err := op(cli); err != nil { - return err - } - } - return nil -} - // ServerInfo stores details about the supported features and platform of the // server type ServerInfo struct { diff --git a/cli/command/cli_test.go b/cli/command/cli_test.go index 7990322fdeef..29f8c3e7ae61 100644 --- a/cli/command/cli_test.go +++ b/cli/command/cli_test.go @@ -255,8 +255,14 @@ func TestInitializeFromClientHangs(t *testing.T) { } func TestNewDockerCliAndOperators(t *testing.T) { - // Test default operations and also overriding default ones - cli, err := NewDockerCli(WithInputStream(io.NopCloser(strings.NewReader("some input")))) + outbuf := bytes.NewBuffer(nil) + errbuf := bytes.NewBuffer(nil) + + cli, err := NewDockerCli( + WithInputStream(io.NopCloser(strings.NewReader("some input"))), + WithOutputStream(outbuf), + WithErrorStream(errbuf), + ) assert.NilError(t, err) // Check streams are initialized assert.Check(t, cli.In() != nil) @@ -266,19 +272,6 @@ func TestNewDockerCliAndOperators(t *testing.T) { assert.NilError(t, err) assert.Equal(t, string(inputStream), "some input") - // Apply can modify a dockerCli after construction - outbuf := bytes.NewBuffer(nil) - errbuf := bytes.NewBuffer(nil) - err = cli.Apply( - WithInputStream(io.NopCloser(strings.NewReader("input"))), - WithOutputStream(outbuf), - WithErrorStream(errbuf), - ) - assert.NilError(t, err) - // Check input stream - inputStream, err = io.ReadAll(cli.In()) - assert.NilError(t, err) - assert.Equal(t, string(inputStream), "input") // Check output stream _, err = fmt.Fprint(cli.Out(), "output") assert.NilError(t, err)