Merge pull request #18793 from jaminthorns/remove-instal-alias-fish-completions
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Docker / docker (Ubuntu ${{ matrix.version }}) (18.04) (push) Has been cancelled
Docker / docker (Ubuntu ${{ matrix.version }}) (20.04) (push) Has been cancelled
Docker / docker (Ubuntu ${{ matrix.version }}) (22.04) (push) Has been cancelled
Docker / docker (Ubuntu ${{ matrix.version }}) (24.04) (push) Has been cancelled
Documentation CI / docs (push) Has been cancelled
Ruby Documentation CI / rubydoc (push) Has been cancelled
Update sponsors, maintainers, manpage and completions / updates (push) Has been cancelled
CI / syntax (push) Has been cancelled
CI / tap syntax (push) Has been cancelled
CI / formula audit (push) Has been cancelled
CI / cask audit (push) Has been cancelled
CI / vendored gems (push) Has been cancelled
CI / ${{ matrix.name }} (update-test (Ubuntu), ubuntu-latest) (push) Has been cancelled
CI / ${{ matrix.name }} (update-test (macOS), macos-15) (push) Has been cancelled
CI / ${{ matrix.name }} (tests (Ubuntu 20.04), ubuntu-20.04, --coverage) (push) Has been cancelled
CI / ${{ matrix.name }} (tests (Ubuntu 22.04), ubuntu-22.04, --coverage) (push) Has been cancelled
CI / ${{ matrix.name }} (tests (Ubuntu 24.04), ubuntu-24.04, --coverage) (push) Has been cancelled
CI / ${{ matrix.name }} (tests (generic OS), ubuntu-latest, --generic --coverage) (push) Has been cancelled
CI / ${{ matrix.name }} (tests (macOS 13 x86_64), macos-13, --coverage) (push) Has been cancelled
CI / ${{ matrix.name }} (tests (macOS 15 arm64), macos-15, --coverage) (push) Has been cancelled
CI / ${{ matrix.name }} (tests (online), ubuntu-latest, --online --coverage) (push) Has been cancelled
CI / ${{ matrix.name }} (ghcr.io/homebrew/ubuntu20.04, test default formula (Ubuntu 20.04), ubuntu-latest) (push) Has been cancelled
CI / ${{ matrix.name }} (ghcr.io/homebrew/ubuntu22.04:master, test default formula (Ubuntu 22.04), ubuntu-latest) (push) Has been cancelled
CI / ${{ matrix.name }} (test default formula (macOS 13 x86_64), macos-13) (push) Has been cancelled
CI / ${{ matrix.name }} (test default formula (macOS 15 arm64), macos-15) (push) Has been cancelled

Remove fish command completions for excluded commands
This commit is contained in:
Mike McQuaid 2024-11-21 08:43:25 +00:00 committed by GitHub
commit 9dad99bdcd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 14 deletions

View File

@ -304,7 +304,11 @@ module Homebrew
return unless command_gets_completions? command
command_description = format_description Commands.command_description(command, short: true), fish: true
lines = ["__fish_brew_complete_cmd '#{command}' '#{command_description}'"]
lines = if COMPLETIONS_EXCLUSION_LIST.include?(command)
[]
else
["__fish_brew_complete_cmd '#{command}' '#{command_description}'"]
end
options = command_options(command).sort.filter_map do |opt, desc|
arg_line = "__fish_brew_complete_arg '#{command}' -l #{opt.sub(/^-+/, "")}"

View File

@ -108,7 +108,6 @@ __brew_complete_tapped() {
__brew_complete_commands() {
# Auto-complete Homebrew commands
# Do NOT auto-complete "*instal" aliases for "*install" commands
local cur="${COMP_WORDS[COMP_CWORD]}"
local cmds
@ -118,10 +117,10 @@ __brew_complete_commands() {
cmds=${__HOMEBREW_COMMANDS}
elif [[ -n ${HOMEBREW_CACHE:-} && -f ${HOMEBREW_CACHE}/all_commands_list.txt ]]
then
cmds="$(< "${HOMEBREW_CACHE}/all_commands_list.txt" \grep -v instal$)"
cmds="$(< "${HOMEBREW_CACHE}/all_commands_list.txt")"
elif [[ -n ${HOMEBREW_REPOSITORY:-} && -f ${HOMEBREW_REPOSITORY}/completions/internal_commands_list.txt ]]
then
cmds="$(< "${HOMEBREW_REPOSITORY}/completions/internal_commands_list.txt" \grep -v instal$)"
cmds="$(< "${HOMEBREW_REPOSITORY}/completions/internal_commands_list.txt")"
fi
while read -r line; do COMPREPLY+=("${line}"); done < <(compgen -W "${cmds}" -- "${cur}")
export __HOMEBREW_COMMANDS=${cmds}

View File

@ -147,9 +147,9 @@ end
function __fish_brew_suggest_commands -d "Lists all commands names, including aliases"
if test -f (brew --cache)/all_commands_list.txt
cat (brew --cache)/all_commands_list.txt | \grep -v instal\$
cat (brew --cache)/all_commands_list.txt
else
cat (brew --repo)/completions/internal_commands_list.txt | \grep -v instal\$
cat (brew --repo)/completions/internal_commands_list.txt
end
end

View File

@ -95,7 +95,6 @@ __brew_complete_tapped() {
__brew_complete_commands() {
# Auto-complete Homebrew commands
# Do NOT auto-complete "*instal" aliases for "*install" commands
local cur="${COMP_WORDS[COMP_CWORD]}"
local cmds
@ -105,10 +104,10 @@ __brew_complete_commands() {
cmds=${__HOMEBREW_COMMANDS}
elif [[ -n ${HOMEBREW_CACHE:-} && -f ${HOMEBREW_CACHE}/all_commands_list.txt ]]
then
cmds="$(< "${HOMEBREW_CACHE}/all_commands_list.txt" \grep -v instal$)"
cmds="$(< "${HOMEBREW_CACHE}/all_commands_list.txt")"
elif [[ -n ${HOMEBREW_REPOSITORY:-} && -f ${HOMEBREW_REPOSITORY}/completions/internal_commands_list.txt ]]
then
cmds="$(< "${HOMEBREW_REPOSITORY}/completions/internal_commands_list.txt" \grep -v instal$)"
cmds="$(< "${HOMEBREW_REPOSITORY}/completions/internal_commands_list.txt")"
fi
while read -r line; do COMPREPLY+=("${line}"); done < <(compgen -W "${cmds}" -- "${cur}")
export __HOMEBREW_COMMANDS=${cmds}

View File

@ -134,9 +134,9 @@ end
function __fish_brew_suggest_commands -d "Lists all commands names, including aliases"
if test -f (brew --cache)/all_commands_list.txt
cat (brew --cache)/all_commands_list.txt | \grep -v instal\$
cat (brew --cache)/all_commands_list.txt
else
cat (brew --repo)/completions/internal_commands_list.txt | \grep -v instal\$
cat (brew --repo)/completions/internal_commands_list.txt
end
end
@ -867,7 +867,6 @@ __fish_brew_complete_arg 'info; and not __fish_seen_argument -l cask -l casks' -
__fish_brew_complete_arg 'info; and not __fish_seen_argument -l formula -l formulae' -a '(__fish_brew_suggest_casks_all)'
__fish_brew_complete_cmd 'instal' 'Install a formula or cask'
__fish_brew_complete_arg 'instal' -l HEAD -d 'If formula defines it, install the HEAD version, aka. main, trunk, unstable, master'
__fish_brew_complete_arg 'instal' -l adopt -d 'Adopt existing artifacts in the destination that are identical to those being installed. Cannot be combined with `--force`'
__fish_brew_complete_arg 'instal' -l appdir -d 'Target location for Applications (default: `/Applications`)'
@ -1612,7 +1611,6 @@ __fish_brew_complete_arg 'unbottled' -l verbose -d 'Make some output more verbos
__fish_brew_complete_arg 'unbottled' -a '(__fish_brew_suggest_formulae_all)'
__fish_brew_complete_cmd 'uninstal' 'Uninstall a formula or cask'
__fish_brew_complete_arg 'uninstal' -l cask -d 'Treat all named arguments as casks'
__fish_brew_complete_arg 'uninstal' -l debug -d 'Display any debugging information'
__fish_brew_complete_arg 'uninstal' -l force -d 'Delete all installed versions of formula. Uninstall even if cask is not installed, overwrite existing files and ignore errors when removing files'
@ -1728,7 +1726,6 @@ __fish_brew_complete_arg 'update-python-resources' -l version -d 'Use the specif
__fish_brew_complete_arg 'update-python-resources' -a '(__fish_brew_suggest_formulae_all)'
__fish_brew_complete_cmd 'update-report' 'The Ruby implementation of `brew update`'
__fish_brew_complete_arg 'update-report' -l auto-update -d 'Run in \'auto-update\' mode (faster, less output)'
__fish_brew_complete_arg 'update-report' -l debug -d 'Display any debugging information'
__fish_brew_complete_arg 'update-report' -l force -d 'Treat installed and updated formulae as if they are from the same taps and migrate them anyway'