completions: typed: strict
This commit is contained in:
parent
05cde76adc
commit
0029308844
@ -1,4 +1,4 @@
|
||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "utils/link"
|
||||
@ -16,8 +16,8 @@ module Homebrew
|
||||
keyword_init: true,
|
||||
)
|
||||
|
||||
COMPLETIONS_DIR = (HOMEBREW_REPOSITORY/"completions").freeze
|
||||
TEMPLATE_DIR = (HOMEBREW_LIBRARY_PATH/"completions").freeze
|
||||
COMPLETIONS_DIR = T.let((HOMEBREW_REPOSITORY/"completions").freeze, Pathname)
|
||||
TEMPLATE_DIR = T.let((HOMEBREW_LIBRARY_PATH/"completions").freeze, Pathname)
|
||||
|
||||
SHELLS = %w[bash fish zsh].freeze
|
||||
COMPLETIONS_EXCLUSION_LIST = %w[
|
||||
@ -26,7 +26,7 @@ module Homebrew
|
||||
update-report
|
||||
].freeze
|
||||
|
||||
BASH_NAMED_ARGS_COMPLETION_FUNCTION_MAPPING = {
|
||||
BASH_NAMED_ARGS_COMPLETION_FUNCTION_MAPPING = T.let({
|
||||
formula: "__brew_complete_formulae",
|
||||
installed_formula: "__brew_complete_installed_formulae",
|
||||
outdated_formula: "__brew_complete_outdated_formulae",
|
||||
@ -38,9 +38,9 @@ module Homebrew
|
||||
command: "__brew_complete_commands",
|
||||
diagnostic_check: '__brewcomp "${__HOMEBREW_DOCTOR_CHECKS=$(brew doctor --list-checks)}"',
|
||||
file: "__brew_complete_files",
|
||||
}.freeze
|
||||
}.freeze, T::Hash[Symbol, String])
|
||||
|
||||
ZSH_NAMED_ARGS_COMPLETION_FUNCTION_MAPPING = {
|
||||
ZSH_NAMED_ARGS_COMPLETION_FUNCTION_MAPPING = T.let({
|
||||
formula: "__brew_formulae",
|
||||
installed_formula: "__brew_installed_formulae",
|
||||
outdated_formula: "__brew_outdated_formulae",
|
||||
@ -52,9 +52,9 @@ module Homebrew
|
||||
command: "__brew_commands",
|
||||
diagnostic_check: "__brew_diagnostic_checks",
|
||||
file: "__brew_formulae_or_ruby_files",
|
||||
}.freeze
|
||||
}.freeze, T::Hash[Symbol, String])
|
||||
|
||||
FISH_NAMED_ARGS_COMPLETION_FUNCTION_MAPPING = {
|
||||
FISH_NAMED_ARGS_COMPLETION_FUNCTION_MAPPING = T.let({
|
||||
formula: "__fish_brew_suggest_formulae_all",
|
||||
installed_formula: "__fish_brew_suggest_formulae_installed",
|
||||
outdated_formula: "__fish_brew_suggest_formulae_outdated",
|
||||
@ -65,7 +65,7 @@ module Homebrew
|
||||
installed_tap: "__fish_brew_suggest_taps_installed",
|
||||
command: "__fish_brew_suggest_commands",
|
||||
diagnostic_check: "__fish_brew_suggest_diagnostic_checks",
|
||||
}.freeze
|
||||
}.freeze, T::Hash[Symbol, String])
|
||||
|
||||
sig { void }
|
||||
def self.link!
|
||||
@ -264,6 +264,7 @@ module Homebrew
|
||||
COMPLETION
|
||||
end
|
||||
|
||||
sig { params(command: String, option: String).returns(String) }
|
||||
def self.generate_zsh_option_exclusions(command, option)
|
||||
conflicts = Commands.option_conflicts(command, option.gsub(/^--/, ""))
|
||||
return "" unless conflicts.presence
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user