diff --git a/Library/Homebrew/abstract_command.rb b/Library/Homebrew/abstract_command.rb index cf13b3c759..e7a5713755 100644 --- a/Library/Homebrew/abstract_command.rb +++ b/Library/Homebrew/abstract_command.rb @@ -17,7 +17,7 @@ module Homebrew class << self sig { returns(String) } - def command_name = T.must(name).split("::").fetch(-1).downcase + def command_name = Utils.underscore(T.must(name).split("::").fetch(-1)).tr("_", "-") # @return the AbstractCommand subclass associated with the brew CLI command name. sig { params(name: String).returns(T.nilable(T.class_of(AbstractCommand))) } diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index d475d6d418..0f042094b8 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -20,7 +20,7 @@ module Homebrew def self.from_cmd_path(cmd_path) cmd_args_method_name = Commands.args_method_name(cmd_path) - cmd_name = cmd_args_method_name.to_s.delete_suffix("_args") + cmd_name = cmd_args_method_name.to_s.delete_suffix("_args").tr("_", "-") begin if require?(cmd_path)