lib/dry/cli/registry.rb in dry-cli-1.1.0 vs lib/dry/cli/registry.rb in dry-cli-1.2.0
- old
+ new
@@ -73,15 +73,15 @@
# prefix.register "app", Generate::App
# prefix.register "action", Generate::Action
# end
# end
# end
- def register(name, command = nil, aliases: [], &block)
- @commands.set(name, command, aliases)
+ def register(name, command = nil, aliases: [], hidden: false, &block)
+ @commands.set(name, command, aliases, hidden)
if block_given?
- prefix = Prefix.new(@commands, name, aliases)
+ prefix = Prefix.new(@commands, name, aliases, hidden)
if block.arity.zero?
prefix.instance_eval(&block)
else
yield(prefix)
end
@@ -306,22 +306,22 @@
#
# @since 0.1.0
class Prefix
# @since 0.1.0
# @api private
- def initialize(registry, prefix, aliases)
+ def initialize(registry, prefix, aliases, hidden)
@registry = registry
@prefix = prefix
- registry.set(prefix, nil, aliases)
+ registry.set(prefix, nil, aliases, hidden)
end
# @since 0.1.0
#
# @see Dry::CLI::Registry#register
- def register(name, command, aliases: [])
+ def register(name, command, aliases: [], hidden: false)
command_name = "#{prefix} #{name}"
- registry.set(command_name, command, aliases)
+ registry.set(command_name, command, aliases, hidden)
end
private
# @since 0.1.0