diff --git a/completions/bash/brew b/completions/bash/brew index ac5de14676..b92b594acd 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -96,8 +96,12 @@ __brew_complete_tapped() { __brew_complete_commands() { local cur="${COMP_WORDS[COMP_CWORD]}" + HOMEBREW_CACHE=$(brew --cache) + HOMEBREW_REPOSITORY=$(brew --repo) # Do not auto-complete "*instal" or "*uninstal" aliases for "*install" commands. - local cmds="$(brew commands --quiet --include-aliases | \grep -v instal$)" + [[ -f "$HOMEBREW_CACHE/all_commands_list.txt" ]] && + local cmds="$(cat "$HOMEBREW_CACHE/all_commands_list.txt" | \grep -v instal$)" || + local cmds="$(cat "$HOMEBREW_REPOSITORY/completions/internal_commands_list.txt" | \grep -v instal$)" COMPREPLY=($(compgen -W "$cmds" -- "$cur")) } diff --git a/completions/fish/brew.fish b/completions/fish/brew.fish index a93bb4c661..aeb394daf5 100644 --- a/completions/fish/brew.fish +++ b/completions/fish/brew.fish @@ -181,7 +181,11 @@ function __fish_brew_suggest_taps_pinned -d "List only pinned taps" end function __fish_brew_suggest_commands -d "Lists all commands names, including aliases" - brew commands --quiet --include-aliases + if test -f (brew --cache)/all_commands_list.txt + cat (brew --cache)/all_commands_list.txt | \grep -v instal\$ + else + cat (brew --repo)/completions/internal_commands_list.txt | \grep -v instal\$ + end end # TODO: any better way to list available services?