Show command when remote execution fail

This commit is contained in:
Thibault Jouan
2014-05-25 15:51:33 +00:00
parent 8168e68a2d
commit 0db2d90b72
6 changed files with 61 additions and 19 deletions

View File

@@ -5,18 +5,22 @@ module Producer
USAGE = "Usage: #{File.basename $0} [-v] [-n] recipe_file".freeze
EX_USAGE = 64
EX_USAGE = 64
EX_SOFTWARE = 70
class << self
def run!(arguments, output: $stderr)
cli = new(arguments)
begin
cli = new(arguments)
cli.parse_arguments!
cli.run
rescue ArgumentError
output.puts USAGE
exit EX_USAGE
rescue RuntimeError => e
output.puts "#{e.class.name.split('::').last}: #{e.message}"
exit EX_SOFTWARE
end
cli.run
end
end