bin/restartable in restartable-0.2.2 vs bin/restartable in restartable-1.0.0
- old
+ new
@@ -12,10 +12,16 @@
Usege:
#{op.program_name} [options] command [arg…]
TEXT
+ op.on('-r', '--on-restart CMD', 'Run CMD on restart') do |cmd|
+ (options[:on_restart] ||= []) << proc{ system cmd }
+ end
+
+ op.separator nil
+
op.on_tail('-h', '--help', 'Show full help') do
puts option_parser.help
exit
end
@@ -25,13 +31,13 @@
end
end
begin
option_parser.order!
- raise OptionParser::ParseError, 'No command to run' if ARGV.empty?
+ fail OptionParser::ParseError, 'No command to run' if ARGV.empty?
rescue OptionParser::ParseError => e
- abort "#{e.to_s}\n\n#{option_parser.help}"
+ abort "#{e}\n\n#{option_parser.help}"
end
Restartable.new(options) do
- exec *ARGV
+ exec(*ARGV)
end