lib/cycromatic/cli.rb in cycromatic-0.1.0 vs lib/cycromatic/cli.rb in cycromatic-0.1.1
- old
+ new
@@ -13,10 +13,14 @@
def initialize(args)
@args = args
OptionParser.new do |opts|
opts.on("--format FORMAT") {|fmt| @format = fmt }
+ opts.on("--version") do
+ puts "cycromatic version #{VERSION}"
+ exit
+ end
end.parse!(args)
end
def run
formatter = @format == 'json' ? JSONFormatter.new(io: STDOUT) : TextFormatter.new(io: STDOUT)
@@ -29,12 +33,9 @@
Calculator.new(node: node).each_complexity do |complexity|
formatter.calculated(path: path, complexity: complexity)
end
end
rescue => exn
- require 'pp'
- p exn
- pp exn.backtrace
formatter.error(path: path, exception: exn)
ensure
formatter.finished path: path
end
end