lib/pronto/cli.rb in pronto-0.2.6 vs lib/pronto/cli.rb in pronto-0.3.0
- old
+ new
@@ -12,10 +12,14 @@
end
end
desc 'run', 'Run Pronto'
+ method_option :'exit-code',
+ type: :boolean,
+ banner: 'Exits with non-zero code if there were any warnings/errors.'
+
method_option :commit,
type: :string,
default: 'master',
aliases: '-c',
banner: 'Commit for the diff'
@@ -37,10 +41,11 @@
gem_names.each do |gem_name|
require "pronto/#{gem_name}"
end
formatter = ::Pronto::Formatter.get(options[:formatter])
- puts ::Pronto.run(options[:commit], '.', formatter)
+ messages = ::Pronto.run(options[:commit], '.', formatter)
+ 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'