Class: Toodledo::CommandLine::InteractiveCommand
- Inherits:
-
BaseCommand
- Object
- CmdParse::Command
- BaseCommand
- Toodledo::CommandLine::InteractiveCommand
- Defined in:
- lib/toodledo/command_line/interactive_command.rb
Overview
Runs the interactive client.
Instance Method Summary collapse
- #command_loop(session) ⇒ Object
- #execute(args) ⇒ Object
-
#initialize(client) ⇒ InteractiveCommand
constructor
A new instance of InteractiveCommand.
Methods inherited from BaseCommand
Constructor Details
#initialize(client) ⇒ InteractiveCommand
Returns a new instance of InteractiveCommand.
10 11 12 13 14 |
# File 'lib/toodledo/command_line/interactive_command.rb', line 10 def initialize(client) super(client, 'interactive', false) self.short_desc = "Interactive client" self.description = "The interactive command line client." end |
Instance Method Details
#command_loop(session) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/toodledo/command_line/interactive_command.rb', line 22 def command_loop(session) loop do begin input = ask("> ") do |q| q.readline = true end input.strip! client.execute_command(session, input) rescue Toodledo::ItemNotFoundError => infe puts "Item not found: #{infe}" rescue Toodledo::ServerError => se puts "Server Error: #{se}" rescue RuntimeError => re puts "Error: #{re}" end end # loop end |