Skip to content

Commit 6855d70

Browse files
authored
Merge pull request #6503 from thaJeztah/rm_apply
cli/command: remove deprecated DockerCli.Apply
2 parents 1a80524 + 1b085a2 commit 6855d70

File tree

2 files changed

+8
-28
lines changed

2 files changed

+8
-28
lines changed

cli/command/cli.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ type Cli interface {
4444
Client() client.APIClient
4545
Streams
4646
SetIn(in *streams.In)
47-
Apply(ops ...CLIOption) error
4847
config.Provider
4948
ServerInfo() ServerInfo
5049
CurrentVersion() string
@@ -551,18 +550,6 @@ func (cli *DockerCli) initialize() error {
551550
return cli.initErr
552551
}
553552

554-
// Apply all the operation on the cli
555-
//
556-
// Deprecated: this method is no longer used and will be removed in the next release if there are no remaining users.
557-
func (cli *DockerCli) Apply(ops ...CLIOption) error {
558-
for _, op := range ops {
559-
if err := op(cli); err != nil {
560-
return err
561-
}
562-
}
563-
return nil
564-
}
565-
566553
// ServerInfo stores details about the supported features and platform of the
567554
// server
568555
type ServerInfo struct {

cli/command/cli_test.go

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,14 @@ func TestInitializeFromClientHangs(t *testing.T) {
255255
}
256256

257257
func TestNewDockerCliAndOperators(t *testing.T) {
258-
// Test default operations and also overriding default ones
259-
cli, err := NewDockerCli(WithInputStream(io.NopCloser(strings.NewReader("some input"))))
258+
outbuf := bytes.NewBuffer(nil)
259+
errbuf := bytes.NewBuffer(nil)
260+
261+
cli, err := NewDockerCli(
262+
WithInputStream(io.NopCloser(strings.NewReader("some input"))),
263+
WithOutputStream(outbuf),
264+
WithErrorStream(errbuf),
265+
)
260266
assert.NilError(t, err)
261267
// Check streams are initialized
262268
assert.Check(t, cli.In() != nil)
@@ -266,19 +272,6 @@ func TestNewDockerCliAndOperators(t *testing.T) {
266272
assert.NilError(t, err)
267273
assert.Equal(t, string(inputStream), "some input")
268274

269-
// Apply can modify a dockerCli after construction
270-
outbuf := bytes.NewBuffer(nil)
271-
errbuf := bytes.NewBuffer(nil)
272-
err = cli.Apply(
273-
WithInputStream(io.NopCloser(strings.NewReader("input"))),
274-
WithOutputStream(outbuf),
275-
WithErrorStream(errbuf),
276-
)
277-
assert.NilError(t, err)
278-
// Check input stream
279-
inputStream, err = io.ReadAll(cli.In())
280-
assert.NilError(t, err)
281-
assert.Equal(t, string(inputStream), "input")
282275
// Check output stream
283276
_, err = fmt.Fprint(cli.Out(), "output")
284277
assert.NilError(t, err)

0 commit comments

Comments
 (0)