Module: Packwerk::Commands

Extended by:
ActiveSupport::Autoload, T::Sig
Defined in:
lib/packwerk/commands.rb,
lib/packwerk/commands/base_command.rb,
lib/packwerk/commands/help_command.rb,
lib/packwerk/commands/init_command.rb,
lib/packwerk/commands/check_command.rb,
lib/packwerk/commands/uses_parse_run.rb,
lib/packwerk/commands/version_command.rb,
lib/packwerk/commands/validate_command.rb,
lib/packwerk/commands/lazy_loaded_entry.rb,
lib/packwerk/commands/update_todo_command.rb

Defined Under Namespace

Classes: BaseCommand, CheckCommand, HelpCommand, InitCommand, UpdateTodoCommand, ValidateCommand, VersionCommand

Class Method Summary collapse

Class Method Details

.allObject



35
36
37
# File 'lib/packwerk/commands.rb', line 35

def all
  registry.dup
end

.for(name_or_alias) ⇒ Object



28
29
30
31
32
# File 'lib/packwerk/commands.rb', line 28

def for(name_or_alias)
  registry
    .find { |command| command.matches_command?(name_or_alias) }
    &.command_class
end

.register(name, aliases: []) ⇒ Object



23
24
25
# File 'lib/packwerk/commands.rb', line 23

def register(name, aliases: [])
  registry << LazyLoadedEntry.new(name, aliases: aliases)
end