cli/command: make WithInitializeClient a wrapper for WithAPIClient

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-05-16 23:31:53 +02:00
parent 0d82ff4ae1
commit 7b1f889074

View File

@ -118,9 +118,11 @@ func WithAPIClient(c client.APIClient) CLIOption {
// an API Client for use by the CLI.
func WithInitializeClient(makeClient func(*DockerCli) (client.APIClient, error)) CLIOption {
return func(cli *DockerCli) error {
var err error
cli.client, err = makeClient(cli)
return err
c, err := makeClient(cli)
if err != nil {
return err
}
return WithAPIClient(c)(cli)
}
}