diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index a35001a936..8cdc7766cc 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -24,6 +24,7 @@ Style/Documentation: AllowedConstants: - Homebrew Include: + - abstract_command.rb - cask/cask.rb - cask/dsl.rb - cask/dsl/version.rb diff --git a/Library/Homebrew/abstract_command.rb b/Library/Homebrew/abstract_command.rb index 6e9e1b7187..8fd46295ef 100644 --- a/Library/Homebrew/abstract_command.rb +++ b/Library/Homebrew/abstract_command.rb @@ -14,6 +14,8 @@ module Homebrew # # To subclass, implement a `run` method and provide a `cmd_args` block to document the command and its allowed args. # To generate method signatures for command args, run `brew typecheck --update`. + # + # @api public class AbstractCommand extend T::Helpers @@ -44,6 +46,9 @@ module Homebrew private + # The description and arguments of the command should be defined within this block. + # + # @api public sig { params(block: T.proc.bind(CLI::Parser).void).void } def cmd_args(&block) @parser_block = T.let(block, T.nilable(T.proc.void)) @@ -59,6 +64,9 @@ module Homebrew @args = T.let(self.class.parser.parse(argv), CLI::Args) end + # This method will be invoked when the command is run. + # + # @api public sig { abstract.void } def run; end end