-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Remove "*instal" aliases from bash completion #3052
Conversation
Remove all command aliases ending in "instal" (single letter L) from the bash completion. This has the practical effect of removing the aliases "instal" and "uninstal" from bash completion, allowing "install" and "uninstall" to be auto completed once the first three characters of each "ins" or "uni" are typed in.
completions/bash/brew
Outdated
@@ -563,10 +563,10 @@ _brew() { | |||
|
|||
if [[ "$i" -eq "$COMP_CWORD" ]] | |||
then | |||
# Do not auto-complete "instal" abbreviation for "install" command. | |||
# Do not auto-complete "*instal" abbreviations for "*install" commands. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Do not auto-complete "instal" or "uninstal" abbreviations for "*install" commands.
I think is a little easier to parse.
completions/bash/brew
Outdated
# Prefix newline to prevent not checking the first command. | ||
local cmds=$'\n'"$(brew commands --quiet --include-aliases)" | ||
__brewcomp "${cmds/$'\n'instal$'\n'/$'\n'}" | ||
local cmds=$'\n'"$(brew commands --quiet --include-aliases | grep -v instal$)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way we can do this without spawning a new grep
process? No worries if not, just wanted to check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only way I could get it to work without calling grep was:
local cmds=$'\n'"$(brew commands --quiet --include-aliases)"
cmds="${cmds/$'\n'uninstal$'\n'/$'\n'}"
__brewcomp "${cmds/$'\n'instal$'\n'/$'\n'}"
I could not figure out a regex pattern that would work to capture both instal and uninstal in a single line, and went for the one liner (which I also find more readable).
@rhwood Thanks for the PR! FYI for future if you're happy to open a PR for an issue you don't need to create an issue first. |
Thanks for your contribution to Homebrew, @rhwood! Without people like you submitting PRs we couldn't run this project. You rock! |
brew tests
with your changes locally?Remove all command aliases ending in "instal" (single letter L) from the bash completion. This has the practical effect of removing the aliases "instal" and "uninstal" from bash completion, allowing "install" and "uninstall" to be auto completed once the first three characters of each "ins" or "uni" are typed in.
This makes bash completion for "uninstall" complete with a following space on the first tab instead of offering two different versions of the same command.
Addresses #3051