diff --git a/bin/gherkin_format b/bin/gherkin_format index daf308c..de7a309 100755 --- a/bin/gherkin_format +++ b/bin/gherkin_format @@ -36,6 +36,15 @@ if options.key? :template exit 0 end +exit_code = 0 + ARGV.each do |file| - formatter.format file, options + begin + formatter.format file, options + rescue StandardError => e + puts e.message + exit_code = 1 + end end + +exit exit_code diff --git a/lib/gherkin_format.rb b/lib/gherkin_format.rb index fc7202a..d046509 100644 --- a/lib/gherkin_format.rb +++ b/lib/gherkin_format.rb @@ -23,9 +23,7 @@ def format(file, options = {}) return if input == output File.write(file, output) if options.key? :replace - - puts "File #{file} is not formatted well." - raise "File #{file} is not formatted well." + raise "File #{file} was not formatted well." end def render(template, files)