lib/cureutils/cli.rb in cureutils-0.1.5 vs lib/cureutils/cli.rb in cureutils-0.2.0

- old
+ new

@@ -22,11 +22,16 @@ def exit_on_failure? true end end - desc 'transform', 'Change human_name to precure_name' + desc 'version', 'Output the version number.' + def version + puts "#{Cureutils.name} #{Cureutils::Version}" + end + + desc 'transform', 'Change human_name to precure_name.' def transform manager = CureTranslateManager.new manager.translate_from_to('[:human_name:]', '[:precure_name:]') manager.in = $stdin exit(manager.print_results) @@ -38,19 +43,40 @@ manager.translate_from_to('[:precure_name:]', '[:human_name:]') manager.in = $stdin exit(manager.print_results) end - desc 'girls', "Print girls' name" + desc 'girls [OPTIONS]', "Print girls' name." + option 'verbose', aliases: 'v', + type: :boolean, + desc: "Include particular girl's full name." + option 'movie', aliases: 'm', + type: :boolean, + desc: 'Include who have only appeared in the movies.' def girls - Rubicure::Girl.config.map { |_k, v| v[:human_name] }.uniq.each do |v| - puts v + girls = Precure.all_stars + girls = girls << Cure.echo if options[:movie] + girls.map!(&:human_name) + if options[:verbose] + girls.each do |v| + puts v + end + else + girls.each do |v| + puts v.gsub(/\([^\)]+\)$/, '') + end end end - desc 'precures', 'Print Precure names' + desc 'precures [OPTIONS]', 'Print Precure names.' + option 'movie', aliases: 'm', + type: :boolean, + desc: 'Include who have only appeared in the movies.' def precures - Rubicure::Girl.config.map { |_k, v| v[:precure_name] }.uniq.each do |v| + cures = Precure.all_stars + cures = cures << Cure.echo if options[:movie] + cures.map!(&:precure_name) + cures.each do |v| puts v end end desc 'grep [OPTIONS] PATTERN', 'Print lines matching a pattern.'