lib/pronto/cli.rb in pronto-0.5.3 vs lib/pronto/cli.rb in pronto-0.6.0

- old
+ new

@@ -33,39 +33,46 @@ type: :array, default: [], aliases: '-r', desc: 'Run only the passed runners' - method_option :formatter, - type: :string, + method_option :formatters, + type: :array, default: 'text', - aliases: '-f', - desc: "Pick output formatter. Available: #{::Pronto::Formatter.names.join(', ')}" + aliases: ['formatter', '-f'], + desc: "Pick output formatters. Available: #{::Pronto::Formatter.names.join(', ')}" def run(path = nil) - gem_names = options[:runner].any? ? options[:runner] : ::Pronto.gem_names + gem_names = options[:runner].any? ? options[:runner] : ::Pronto::GemNames.new.to_a gem_names.each do |gem_name| require "pronto/#{gem_name}" end - formatter = ::Pronto::Formatter.get(options[:formatter]) + formatters = ::Pronto::Formatter.get(options[:formatters]) commit = options[:index] ? :index : options[:commit] - messages = ::Pronto.run(commit, '.', formatter, path) + messages = ::Pronto.run(commit, '.', formatters, path) exit(messages.count) if options[:'exit-code'] rescue Rugged::RepositoryError puts '"pronto" should be run from a git repository' end desc 'list', 'Lists pronto runners that are available to be used' def list - puts ::Pronto.gem_names + puts ::Pronto::GemNames.new.to_a end - desc 'version', 'Show the Pronto version' + desc 'version', 'Display version' map %w(-v --version) => :version def version - puts "Pronto version #{::Pronto::VERSION}" + puts Version::STRING + end + + desc 'verbose-version', 'Display verbose version' + map %w(-V --verbose-version) => :verbose_version + + def verbose_version + puts Version.verbose end end end