Skip to content

Commit 7b1f889

Browse files
committed
cli/command: make WithInitializeClient a wrapper for WithAPIClient
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 0d82ff4 commit 7b1f889

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

cli/command/cli_options.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ func WithAPIClient(c client.APIClient) CLIOption {
118118
// an API Client for use by the CLI.
119119
func WithInitializeClient(makeClient func(*DockerCli) (client.APIClient, error)) CLIOption {
120120
return func(cli *DockerCli) error {
121-
var err error
122-
cli.client, err = makeClient(cli)
123-
return err
121+
c, err := makeClient(cli)
122+
if err != nil {
123+
return err
124+
}
125+
return WithAPIClient(c)(cli)
124126
}
125127
}
126128

0 commit comments

Comments
 (0)