cmd/docker: enable cobra completion descriptions#5756
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5756 +/- ##
=======================================
Coverage 59.47% 59.47%
=======================================
Files 346 346
Lines 29367 29367
=======================================
Hits 17465 17465
Misses 10929 10929
Partials 973 973 |
|
Side note but I wonder if we can make this not print all the candidates – before, multiple commands would fit into a single line, so it didn't take up as much space. With this, my terminal gets completely filled with the autocomplete suggestions because each command takes up an entire line. |
|
I think this one also needs to be updated; cli/cli-plugins/plugin/plugin.go Lines 158 to 162 in f4a68da |
This patch enables descriptions on the CLI completion script. It used to be disabled due to the CLI historically not supporting cobra v2 completions, as seen by this patch docker@cbec75e. As an escape hatch, the user can set the `DOCKER_CLI_DISABLE_COMPLETION_DESCRIPTION` environment variable to disable the completion description when generating the completion file with `docker completion <fish|bash|zsh>`. Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
37ecc58 to
4c2fece
Compare
| DisableDefaultCmd: false, | ||
| HiddenDefaultCmd: true, | ||
| DisableDescriptions: true, | ||
| DisableDescriptions: os.Getenv("DOCKER_CLI_DISABLE_COMPLETION_DESCRIPTION") != "", |
There was a problem hiding this comment.
cc @crazy-max I think descriptions are enabled by default in buildx; do you think it'd make sense for it to also support this env-var? (at least when running as plugin)
cc @glours (not sure what currently the default is on compose, but "same" question for there)
This patch enables descriptions on the CLI completion script. It used to be disabled due to the CLI historically not supporting cobra v2 completions, as seen by this patch
cbec75e.
As an escape hatch, the user can set the
DOCKER_CLI_DISABLE_COMPLETION_DESCRIPTIONenvironment variable to disable the completion description when
generating the completion file with
docker completion <fish|bash|zsh>.- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)