Skip to content

Commit 0d82ff4

Browse files
committed
cli/command: move WithInitializeClient to other options
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 8e5fb5b commit 0d82ff4

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

cli/command/cli.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,6 @@ func (cli *DockerCli) HooksEnabled() bool {
222222
return false
223223
}
224224

225-
// WithInitializeClient is passed to DockerCli.Initialize by callers who wish to set a particular API Client for use by the CLI.
226-
func WithInitializeClient(makeClient func(dockerCli *DockerCli) (client.APIClient, error)) CLIOption {
227-
return func(dockerCli *DockerCli) error {
228-
var err error
229-
dockerCli.client, err = makeClient(dockerCli)
230-
return err
231-
}
232-
}
233-
234225
// Initialize the dockerCli runs initialization that must happen after command
235226
// line flags are parsed.
236227
func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...CLIOption) error {

cli/command/cli_options.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ func WithAPIClient(c client.APIClient) CLIOption {
114114
}
115115
}
116116

117+
// WithInitializeClient is passed to [DockerCli.Initialize] to initialize
118+
// an API Client for use by the CLI.
119+
func WithInitializeClient(makeClient func(*DockerCli) (client.APIClient, error)) CLIOption {
120+
return func(cli *DockerCli) error {
121+
var err error
122+
cli.client, err = makeClient(cli)
123+
return err
124+
}
125+
}
126+
117127
// envOverrideHTTPHeaders is the name of the environment-variable that can be
118128
// used to set custom HTTP headers to be sent by the client. This environment
119129
// variable is the equivalent to the HttpHeaders field in the configuration

0 commit comments

Comments
 (0)