Handle dashed commands

This commit is contained in:
Douglas Eichelberger 2024-03-19 12:43:51 -07:00
parent 6b19bc5535
commit bf9ebccecd
2 changed files with 2 additions and 2 deletions

View File

@ -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))) }

View File

@ -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)