docker / cli

The Docker CLI
Apache License 2.0
4.75k stars 1.88k forks source link

cli/command: use shallower interface for completions #5111

Closed thaJeztah closed 1 month ago

thaJeztah commented 1 month ago

The completion functions only need the API-client, and not all of the CLI. However, passing the API-client as argument would mean that the API-client is initialized early, which may not be what we want, so instead, defining an APIClientProvider interface to preserve the behavior of initializing when needed only.

While updating, also simplify stack.format to only require an io.Writer.

- A picture of a cute animal (not mandatory but encouraged)

codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 28.57143% with 10 lines in your changes missing coverage. Please review.

Project coverage is 61.37%. Comparing base (ce85b24) to head (20d1b66).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #5111 +/- ## ========================================== + Coverage 61.34% 61.37% +0.03% ========================================== Files 295 298 +3 Lines 20712 20717 +5 ========================================== + Hits 12705 12715 +10 + Misses 7104 7102 -2 + Partials 903 900 -3 ```
thaJeztah commented 1 month ago

Thx! Let me bring this one in 👍