lib/eco/cli/config/options_set.rb in eco-helpers-2.0.25 vs lib/eco/cli/config/options_set.rb in eco-helpers-2.0.26

- old
+ new

@@ -12,20 +12,22 @@ @core_config = core_config @sets = {} end # @return [String] summary of the options. - def help + def help(refine: nil) indent = 2 spaces = any_non_general_space_active? ? active_namespaces : namespaces - - ["The following are the available options:"].yield_self do |lines| + refinement = refine.is_a?(String)? " (containing: '#{refine}')" : "" + ["The following are the available options#{refinement}:"].yield_self do |lines| max_len = keys_max_len(options_args(spaces)) + indent spaces.each do |namespace| is_general = (namespace == :general) str_indent = is_general ? "" : " " * indent lines << help_line(namespace, "", max_len) unless is_general - options_set(namespace).each do |arg, option| + options_set(namespace).select do |arg, option| + refine.is_a?(String) && option.name.include?(refine) + end.each do |arg, option| lines << help_line(" " * indent + "#{option.name}", option.description, max_len) end end lines end.join("\n")