mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Handle dashed commands
This commit is contained in:
parent
6b19bc5535
commit
bf9ebccecd
@ -17,7 +17,7 @@ module Homebrew
|
|||||||
|
|
||||||
class << self
|
class << self
|
||||||
sig { returns(String) }
|
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.
|
# @return the AbstractCommand subclass associated with the brew CLI command name.
|
||||||
sig { params(name: String).returns(T.nilable(T.class_of(AbstractCommand))) }
|
sig { params(name: String).returns(T.nilable(T.class_of(AbstractCommand))) }
|
||||||
|
@ -20,7 +20,7 @@ module Homebrew
|
|||||||
|
|
||||||
def self.from_cmd_path(cmd_path)
|
def self.from_cmd_path(cmd_path)
|
||||||
cmd_args_method_name = Commands.args_method_name(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
|
begin
|
||||||
if require?(cmd_path)
|
if require?(cmd_path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user