Skip to content

Commit 1b085a2

Browse files
committed
cli/command: remove deprecated DockerCli.Apply
The Apply method was added when CLI options for constructing the CLI were rewritten into functional options in [cli@7f207f3]. There was no mention in the pull request of this method specifically, and this may have been related to work being done elsewhere on compose-on-kubernetes or the compose-cli plugin that may have needed options to modify the CLI config after it was already initialized. The CLI itself no longer depends on this method since [cli@133279f], and there are no known external users. It was deprecated in [cli@24bfedf], which is included in the 28.5.0 release, so we can remove it for 29.0. [cli@7f207f3]: 7f207f3 [cli@133279f]: 133279f [cli@24bfedf]: 24bfedf Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent b0cb640 commit 1b085a2

File tree

2 files changed

+8
-27
lines changed

2 files changed

+8
-27
lines changed

cli/command/cli.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -566,18 +566,6 @@ func (cli *DockerCli) initialize() error {
566566
return cli.initErr
567567
}
568568

569-
// Apply all the operation on the cli
570-
//
571-
// Deprecated: this method is no longer used and will be removed in the next release if there are no remaining users.
572-
func (cli *DockerCli) Apply(ops ...CLIOption) error {
573-
for _, op := range ops {
574-
if err := op(cli); err != nil {
575-
return err
576-
}
577-
}
578-
return nil
579-
}
580-
581569
// ServerInfo stores details about the supported features and platform of the
582570
// server
583571
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)