@@ -10,11 +10,21 @@ import (
1010 "github.com/moby/term"
1111)
1212
13+ // CLIOption applies a modification on a DockerCli.
14+ type CLIOption func (cli * DockerCli ) error
15+
1316// DockerCliOption applies a modification on a DockerCli.
14- type DockerCliOption func (cli * DockerCli ) error
17+ //
18+ // Deprecated: use [CLIOption] instead.
19+ type DockerCliOption = CLIOption
20+
21+ // InitializeOpt is the type of the functional options passed to DockerCli.Initialize
22+ //
23+ // Deprecated: use [CLIOption] instead.
24+ type InitializeOpt = CLIOption
1525
1626// WithStandardStreams sets a cli in, out and err streams with the standard streams.
17- func WithStandardStreams () DockerCliOption {
27+ func WithStandardStreams () CLIOption {
1828 return func (cli * DockerCli ) error {
1929 // Set terminal emulation based on platform as required.
2030 stdin , stdout , stderr := term .StdStreams ()
@@ -26,7 +36,7 @@ func WithStandardStreams() DockerCliOption {
2636}
2737
2838// WithCombinedStreams uses the same stream for the output and error streams.
29- func WithCombinedStreams (combined io.Writer ) DockerCliOption {
39+ func WithCombinedStreams (combined io.Writer ) CLIOption {
3040 return func (cli * DockerCli ) error {
3141 cli .out = streams .NewOut (combined )
3242 cli .err = combined
@@ -35,31 +45,31 @@ func WithCombinedStreams(combined io.Writer) DockerCliOption {
3545}
3646
3747// WithInputStream sets a cli input stream.
38- func WithInputStream (in io.ReadCloser ) DockerCliOption {
48+ func WithInputStream (in io.ReadCloser ) CLIOption {
3949 return func (cli * DockerCli ) error {
4050 cli .in = streams .NewIn (in )
4151 return nil
4252 }
4353}
4454
4555// WithOutputStream sets a cli output stream.
46- func WithOutputStream (out io.Writer ) DockerCliOption {
56+ func WithOutputStream (out io.Writer ) CLIOption {
4757 return func (cli * DockerCli ) error {
4858 cli .out = streams .NewOut (out )
4959 return nil
5060 }
5161}
5262
5363// WithErrorStream sets a cli error stream.
54- func WithErrorStream (err io.Writer ) DockerCliOption {
64+ func WithErrorStream (err io.Writer ) CLIOption {
5565 return func (cli * DockerCli ) error {
5666 cli .err = err
5767 return nil
5868 }
5969}
6070
6171// WithContentTrustFromEnv enables content trust on a cli from environment variable DOCKER_CONTENT_TRUST value.
62- func WithContentTrustFromEnv () DockerCliOption {
72+ func WithContentTrustFromEnv () CLIOption {
6373 return func (cli * DockerCli ) error {
6474 cli .contentTrust = false
6575 if e := os .Getenv ("DOCKER_CONTENT_TRUST" ); e != "" {
@@ -73,23 +83,23 @@ func WithContentTrustFromEnv() DockerCliOption {
7383}
7484
7585// WithContentTrust enables content trust on a cli.
76- func WithContentTrust (enabled bool ) DockerCliOption {
86+ func WithContentTrust (enabled bool ) CLIOption {
7787 return func (cli * DockerCli ) error {
7888 cli .contentTrust = enabled
7989 return nil
8090 }
8191}
8292
8393// WithDefaultContextStoreConfig configures the cli to use the default context store configuration.
84- func WithDefaultContextStoreConfig () DockerCliOption {
94+ func WithDefaultContextStoreConfig () CLIOption {
8595 return func (cli * DockerCli ) error {
8696 cli .contextStoreConfig = DefaultContextStoreConfig ()
8797 return nil
8898 }
8999}
90100
91101// WithAPIClient configures the cli to use the given API client.
92- func WithAPIClient (c client.APIClient ) DockerCliOption {
102+ func WithAPIClient (c client.APIClient ) CLIOption {
93103 return func (cli * DockerCli ) error {
94104 cli .client = c
95105 return nil
0 commit comments