lib/pennyworth/cli.rb in pennyworth-3.1.0 vs lib/pennyworth/cli.rb in pennyworth-3.2.0

- old
+ new

@@ -2,14 +2,17 @@ require "thor" require "thor/actions" require "thor_plus/actions" module Pennyworth + # The Command Line Interface (CLI) for the gem. class CLI < Thor include Thor::Actions include ThorPlus::Actions + package_name Pennyworth::Identity.version_label + # Overwrites the Thor template source root. def self.source_root File.expand_path File.join(File.dirname(__FILE__), "templates") end @@ -26,19 +29,19 @@ method_option :upcase, aliases: "-u", desc: "Upcase a string.", type: :array method_option :capitalize, aliases: "-c", desc: "Capitalize words in a string.", type: :array method_option :length, aliases: "-l", desc: "Answer the length of a string.", type: :array def string case - when options[:downcase] - Pennyworth::Kits::String.downcase options[:downcase] - when options[:upcase] - Pennyworth::Kits::String.upcase options[:upcase] - when options[:capitalize] - Pennyworth::Kits::String.capitalize options[:capitalize] - when options[:length] - Pennyworth::Kits::String.length options[:length] - else say("Type 'pennyworth help string' for usage.") + when options[:downcase] + Pennyworth::Kits::String.downcase options[:downcase] + when options[:upcase] + Pennyworth::Kits::String.upcase options[:upcase] + when options[:capitalize] + Pennyworth::Kits::String.capitalize options[:capitalize] + when options[:length] + Pennyworth::Kits::String.length options[:length] + else say("Type 'pennyworth help string' for usage.") end end desc "-i, [install]", "Install Alfred Workflows." map %w(-i --install) => :install @@ -67,24 +70,24 @@ end say end - desc "-e, [edit]", "Edit gem settings in default editor (assumes $EDITOR environment variable)." + desc "-e, [--edit]", "Edit #{Pennyworth::Identity.label} settings in default editor." map %w(-e --edit) => :edit def edit `#{editor} #{@settings_file}` end - desc "-v, [--version]", "Show version." + desc "-v, [--version]", "Show #{Pennyworth::Identity.label} version." map %w(-v --version) => :version def version - say Pennyworth::Identity.label_version + say Pennyworth::Identity.version_label end desc "-h, [--help=HELP]", "Show this message or get help for a command." map %w(-h --help) => :help def help task = nil - say and super + say && super end end end