# File lib/plugins/defaults/command_line.rb, line 25 def call(command_text) # Example: # t.register_hook(:post_all, :point => :prepare_command) do |s| # "update #{s}" # end Client.get_hooks('prepare_command').each {|hook| command_text = hook.call(command_text) } Client.execute(command_text) rescue CommandNotFound => e hooks = Client.get_hooks('command_not_found') raise e if hooks.empty? hooks.each {|hook| hook.call(command_text) } rescue TimeoutError puts TermColor.parse("<red>Time out :(</red>") end
# File lib/plugins/another_prompt.rb, line 94 def call_prompt(command) Client.execute("curry #{command}") if buf = Readline.readline(ERB.new(prompt).result(Termtter::API.twitter.__send__(:binding)), true) Readline::HISTORY.pop if buf.empty? begin call(buf) rescue Exception => e Client.handle_error(e) end else puts end ensure Client.execute('uncurry') end
# File lib/plugins/defaults/command_line.rb, line 44 def prompt prompt_text = config.prompt Client.get_hooks('prepare_prompt').each {|hook| prompt_text = hook.call(prompt_text) } prompt_text end
# File lib/plugins/defaults/command_line.rb, line 17 def start start_input_thread end
# File lib/plugins/another_prompt.rb, line 72 def start_input_thread setup_readline() trap_setting() @input_thread = Thread.new do loop do begin value = config.plugins.another_prompt.shortcut_setting[wait_keypress] Client.pause case value when String call_prompt(value) when Proc value.call end ensure Client.resume end end end @input_thread.join end
# File lib/plugins/defaults/command_line.rb, line 21 def stop @input_thread.kill if @input_thread end
Generated with the Darkfish Rdoc Generator 2.