Class: Tap::Prompt
Overview
:startdoc::prompt
A prompt to signal a running app. Any signals that return app (ie /run /stop /terminate) will exit the prompt.
Instance Attribute Summary
Attributes inherited from App::Api
Instance Method Summary collapse
Methods inherited from App::Api
#associations, build, help, inherited, #initialize, parse, parse!, parser, #to_spec
Methods included from Signals
Methods included from Signals::ModuleMethods
Constructor Details
This class inherits a constructor from Tap::App::Api
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tap/prompt.rb', line 12 def call puts "starting prompt (help for help):" loop do begin line = Readline.readline('--/', true).strip next if line.empty? args = Shellwords.shellwords(line) "/#{args.shift}" =~ Tap::Parser::SIGNAL result = app.call('obj' => $1, 'sig' => $2, 'args' => args) if result == app break else puts "=> #{result}" end rescue puts $!. puts $!.backtrace if app.debug? end end end |