Skip to content

Commit 4c2fece

Browse files
committed
cmd/docker: enable cobra completion descriptions
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_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>
1 parent f4a68da commit 4c2fece

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

cli-plugins/plugin/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func newPluginCommand(dockerCli *command.DockerCli, plugin *cobra.Command, meta
158158
CompletionOptions: cobra.CompletionOptions{
159159
DisableDefaultCmd: false,
160160
HiddenDefaultCmd: true,
161-
DisableDescriptions: true,
161+
DisableDescriptions: os.Getenv("DOCKER_CLI_DISABLE_COMPLETION_DESCRIPTION") != "",
162162
},
163163
}
164164
opts, _ := cli.SetupPluginRootCommand(cmd)

cmd/docker/docker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func newDockerCommand(dockerCli *command.DockerCli) *cli.TopLevelCommand {
9292
CompletionOptions: cobra.CompletionOptions{
9393
DisableDefaultCmd: false,
9494
HiddenDefaultCmd: true,
95-
DisableDescriptions: true,
95+
DisableDescriptions: os.Getenv("DOCKER_CLI_DISABLE_COMPLETION_DESCRIPTION") != "",
9696
},
9797
}
9898
cmd.SetIn(dockerCli.In())

0 commit comments

Comments
 (0)