lib/pronto/cli.rb in pronto-0.3.3 vs lib/pronto/cli.rb in pronto-0.4.0

- old
+ new

@@ -22,10 +22,15 @@ type: :string, default: 'master', aliases: '-c', banner: 'Commit for the diff' + method_option :index, + type: :boolean, + aliases: '-i', + banner: 'Analyze changes in git index (staging area)' + method_option :runner, type: :array, default: [], aliases: '-r', banner: 'Run only the passed runners' @@ -34,17 +39,18 @@ type: :string, default: 'text', aliases: '-f', banner: "Pick output formatter. Available: #{::Pronto::Formatter.names.join(', ')}" - def run + def run(path = nil) gem_names = options[:runner].any? ? options[:runner] : ::Pronto.gem_names gem_names.each do |gem_name| require "pronto/#{gem_name}" end formatter = ::Pronto::Formatter.get(options[:formatter]) - messages = ::Pronto.run(options[:commit], '.', formatter) + commit = options[:index] ? :index : options[:commit] + messages = ::Pronto.run(commit, '.', formatter, path) exit(messages.count) if options[:'exit-code'] rescue Rugged::RepositoryError puts '"pronto" should be run from a git repository' end