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

- old
+ new

@@ -27,13 +27,16 @@ @core_config = core_config @linked_cases = {} end # @return [String] summary of the use cases. - def help - ["The following are the available use cases:"].yield_self do |lines| + def help(refine: nil) + refinement = refine.is_a?(String)? " (containing: '#{refine}')" : "" + ["The following are the available use cases#{refinement}:"].yield_self do |lines| max_len = keys_max_len(@linked_cases.keys) - @linked_cases.keys.sort.each do |option_case| + @linked_cases.keys.sort.select do |key| + refine.is_a?(String) && key.include?(refine) + end.each do |option_case| lines << help_line(option_case, @linked_cases[option_case].description, max_len) end lines end.join("\n") end