Class: Hanami::CLI::Registry::Prefix

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/cli/registry.rb

Overview

Command name prefix

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initialize(registry, prefix, aliases) ⇒ Prefix

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Prefix

Since:

  • 0.1.0


95
96
97
98
99
100
# File 'lib/hanami/cli/registry.rb', line 95

def initialize(registry, prefix, aliases)
  @registry = registry
  @prefix   = prefix

  registry.set(prefix, nil, aliases)
end

Instance Method Details

#register(name, command, aliases: [], **options) ⇒ Object

See Also:

Since:

  • 0.1.0


105
106
107
108
# File 'lib/hanami/cli/registry.rb', line 105

def register(name, command, aliases: [], **options)
  command_name = "#{prefix} #{name}"
  registry.set(command_name, command, aliases, **options)
end