cmd/run.rb in bahuvrihi-tap-0.10.4 vs cmd/run.rb in bahuvrihi-tap-0.10.5
- old
+ new
@@ -12,28 +12,26 @@
# handle options
#
dump = false
OptionParser.new do |opts|
- cmdline = Tap::Support::CommandLine
-
opts.separator ""
opts.separator "configurations:"
Tap::App.configurations.each do |receiver, key, config|
next if receiver == Tap::Root
- opts.on(*cmdline.configv(config)) do |value|
+ opts.on(*config.to_optparse_argv) do |value|
app.send(config.writer, value)
end
end
opts.separator ""
opts.separator "options:"
opts.on("-h", "--help", "Show this message") do
- opts.banner = cmdline.usage(__FILE__)
+ opts.banner = Tap::Support::Lazydoc.usage(__FILE__)
Tap::App.lazydoc.resolve
puts opts
exit
end
@@ -43,61 +41,19 @@
end
end.parse!(ARGV)
#
-# handle options for each specified task
+# build and run the argv
#
queues = env.build(ARGV)
ARGV.clear
if queues.empty?
puts "no task specified"
exit
end
-#
-# set signals
-#
-
-# info signal -- Note: some systems do
-# not support the INFO signal
-# (windows, fedora, at least)
-signals = Signal.list.keys
-if signals.include?("INFO")
- Signal.trap("INFO") do
- puts app.info
- end
-end
-
-# interuption signal
-if signals.include?("INT")
- Signal.trap("INT") do
- puts " interrupted!"
- # prompt for decision
- while true
- print "stop, terminate, exit, or resume? (s/t/e/r):"
- case gets.strip
- when /s(top)?/i
- app.stop
- break
- when /t(erminate)?/i
- app.terminate
- break
- when /e(xit)?/i
- exit
- when /r(esume)?/i
- break
- else
- puts "unexpected response..."
- end
- end
- end
-end
-
-#
-# enque tasks and run!
-#
-
+env.set_signals
env.run(queues)