mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #7455 from EricFromCanada/bash-command-completion
completions/bash: complete names of commands
This commit is contained in:
commit
d48d1e5e2c
@ -94,6 +94,13 @@ __brew_complete_tapped() {
|
|||||||
__brewcomp "$taps"
|
__brewcomp "$taps"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__brew_complete_commands() {
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
# Do not auto-complete "*instal" or "*uninstal" aliases for "*install" commands.
|
||||||
|
local cmds="$(brew commands --quiet --include-aliases | \grep -v instal$)"
|
||||||
|
COMPREPLY=($(compgen -W "$cmds" -- "$cur"))
|
||||||
|
}
|
||||||
|
|
||||||
_brew_analytics() {
|
_brew_analytics() {
|
||||||
case "$COMP_CWORD" in
|
case "$COMP_CWORD" in
|
||||||
2) __brewcomp "off on regenerate-uuid state" ;;
|
2) __brewcomp "off on regenerate-uuid state" ;;
|
||||||
@ -816,10 +823,7 @@ _brew() {
|
|||||||
|
|
||||||
if [[ "$i" -eq "$COMP_CWORD" ]]
|
if [[ "$i" -eq "$COMP_CWORD" ]]
|
||||||
then
|
then
|
||||||
# Do not auto-complete "*instal" or "*uninstal" aliases for "*install" commands.
|
__brew_complete_commands
|
||||||
# Prefix newline to prevent not checking the first command.
|
|
||||||
local cmds=$'\n'"$(brew commands --quiet --include-aliases | \grep -v instal$)"
|
|
||||||
__brewcomp "$cmds"
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -834,6 +838,7 @@ _brew() {
|
|||||||
cask) _brew_cask ;;
|
cask) _brew_cask ;;
|
||||||
cat) __brew_complete_formulae ;;
|
cat) __brew_complete_formulae ;;
|
||||||
cleanup) _brew_cleanup ;;
|
cleanup) _brew_cleanup ;;
|
||||||
|
command) __brew_complete_commands ;;
|
||||||
create) _brew_create ;;
|
create) _brew_create ;;
|
||||||
deps) _brew_deps ;;
|
deps) _brew_deps ;;
|
||||||
desc) _brew_desc ;;
|
desc) _brew_desc ;;
|
||||||
@ -842,6 +847,7 @@ _brew() {
|
|||||||
edit) __brew_complete_formulae ;;
|
edit) __brew_complete_formulae ;;
|
||||||
fetch) _brew_fetch ;;
|
fetch) _brew_fetch ;;
|
||||||
gist-logs) _brew_gist_logs ;;
|
gist-logs) _brew_gist_logs ;;
|
||||||
|
help) __brew_complete_commands ;;
|
||||||
home|homepage) __brew_complete_formulae ;;
|
home|homepage) __brew_complete_formulae ;;
|
||||||
info|abv) _brew_info ;;
|
info|abv) _brew_info ;;
|
||||||
install|instal) _brew_install ;;
|
install|instal) _brew_install ;;
|
||||||
@ -855,6 +861,7 @@ _brew() {
|
|||||||
outdated) _brew_outdated ;;
|
outdated) _brew_outdated ;;
|
||||||
pin) __brew_complete_formulae ;;
|
pin) __brew_complete_formulae ;;
|
||||||
postinstall) _brew_postinstall ;;
|
postinstall) _brew_postinstall ;;
|
||||||
|
prof) __brew_complete_commands ;;
|
||||||
pull) _brew_pull ;;
|
pull) _brew_pull ;;
|
||||||
readall) _brew_readall ;;
|
readall) _brew_readall ;;
|
||||||
reinstall) _brew_install ;;
|
reinstall) _brew_install ;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user