lib/synvert/cli.rb in synvert-0.0.15 vs lib/synvert/cli.rb in synvert-0.0.16
- old
+ new
@@ -38,12 +38,18 @@
end
end
true
rescue SystemExit
true
+ rescue Parser::SyntaxError => e
+ puts "Syntax error: #{e.message}"
+ puts "file #{e.diagnostic.location.source_buffer.name}"
+ puts "line #{e.diagnostic.location.line}"
+ false
rescue Exception => e
- puts "Error: " + e.message
+ print "Error: "
+ p e
false
end
private
@@ -66,10 +72,14 @@
@options[:snippet_name] = snippet_name
end
opts.on '-r', '--run SNIPPET_NAMES', 'run specified snippets' do |snippet_names|
@options[:snippet_names] = snippet_names.split(',').map(&:strip)
end
+ opts.on '-v', '--version', 'show this version' do
+ puts Synvert::VERSION
+ exit
+ end
end
paths = optparse.parse(args)
Configuration.instance.set :path, paths.first || Dir.pwd
end
@@ -88,10 +98,10 @@
end
# List and print all available rewriters.
def list_available_rewriters
Rewriter.availables.each do |rewriter|
- print rewriter.name + " "
+ print rewriter.name.to_s + " "
end
puts
end
# Query and print available rewriters.