lib/dry/cli/banner.rb in dry-cli-0.5.1 vs lib/dry/cli/banner.rb in dry-cli-0.6.0
- old
+ new
@@ -14,22 +14,20 @@
# @param command [Dry::CLI::Command] the command
# @param out [IO] standard output
#
# @since 0.1.0
# @api private
- def self.call(command, out, names)
+ def self.call(command, names)
full_command_name = full_command_name(names)
- output = [
+ [
command_name(full_command_name),
command_name_and_arguments(command, full_command_name),
command_description(command),
command_arguments(command),
command_options(command),
command_examples(command, full_command_name)
].compact.join("\n")
-
- out.puts output
end
# @since 0.1.0
# @api private
def self.command_name(name)
@@ -105,9 +103,11 @@
def self.extended_command_options(command)
result = command.options.map do |option|
name = Inflector.dasherize(option.name)
name = if option.boolean?
"[no-]#{name}"
+ elsif option.array?
+ "#{name}=VALUE1,VALUE2,.."
else
"#{name}=VALUE"
end
name = "#{name}, #{option.alias_names.join(', ')}" if option.aliases.any?
name = " --#{name.ljust(30)}"