lib/hammer_cli/abstract.rb in hammer_cli-0.18.0 vs lib/hammer_cli/abstract.rb in hammer_cli-0.18.1
- old
+ new
@@ -45,11 +45,12 @@
begin
h.find_item(:s_option_details)
rescue ArgumentError
option_details = HammerCLI::Help::Section.new(_('Option details'), nil, id: :s_option_details, richtext: true)
option_details.definition << HammerCLI::Help::Text.new(
- _('Following parameters accept format defined by its schema (bold are required):')
+ _('Following parameters accept format defined by its schema ' \
+ '(bold are required; <> contain acceptable type; [] contain acceptable value):')
)
h.definition.unshift(option_details)
ensure
h.find_item(:s_option_details).definition << HammerCLI::Help::List.new([
[option.switches.last, option.value_formatter.schema.description]
@@ -307,14 +308,16 @@
attribute.of(self).set(value)
end
end
def self.option(switches, type, description, opts = {}, &block)
- HammerCLI::Options::OptionDefinition.new(switches, type, description, opts).tap do |option|
+ option = HammerCLI::Options::OptionDefinition.new(switches, type, description, opts).tap do |option|
declared_options << option
block ||= option.default_conversion_block
define_accessors_for(option, &block)
end
+ extend_options_help(option) if option.value_formatter.is_a?(HammerCLI::Options::Normalizers::ListNested)
+ option
end
def all_options
option_collector.all_options
end