Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove asterisk from docker command suggestions #3540

Merged
merged 1 commit into from Apr 6, 2022

Conversation

mcornella
Copy link
Contributor

@mcornella mcornella commented Apr 6, 2022

fixes #3631

- What I did

Some commands in the output of docker show up with an asterisk, like app, build, buildx or scan.

image

This tweak removes them so that the asterisk is not filled in when choosing those commands.

- How I did it

In __docker_commands, the output of docker is parsed to get the list of valid commands. The function already trims whitespace from left and right. I just added a zsh-regex pattern for an asterisk on the right-hand side to remove it as well.

The zsh regex \*# is equivalent to POSIX regex \** (0 or more occurrences of *) (note that this requires setopt extendedglob).

- How to verify it

  1. Clone this PR and cd into the project root.
  2. Run unfunction _docker if docker completion has been attempted before.
  3. Run autoload -Uz $PWD/contrib/completion/zsh/_docker.
  4. Attempt to complete docker .

Suggestion entries should appear without a trailing asterisk:

image

- Description for the changelog

Remove trailing asterisk from zsh completion for docker commands.

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

kitten at computer

Some commands in the output of `docker` show up with an asterisk, like
app, build, buildx or scan. This tweak removes that so that the
asterisk is not filled in when choosing those commands.

Signed-off-by: Marc Cornellà <hello@mcornella.com>
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@thaJeztah thaJeztah merged commit 59449a5 into docker:master Apr 6, 2022
@mcornella mcornella deleted the fix/asterisk-in-zsh-completion branch April 6, 2022 19:35
@mcornella
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] zsh completion contains trailing '*'
2 participants