Class: Toodledo::CommandLine::AddTaskCommand
- Inherits:
-
BaseCommand
- Object
- CmdParse::Command
- BaseCommand
- Toodledo::CommandLine::AddTaskCommand
- Defined in:
- lib/toodledo/command_line/add_command.rb
Overview
Adds a task from the command line.
Instance Method Summary collapse
- #execute(args) ⇒ Object
-
#initialize(client) ⇒ AddTaskCommand
constructor
A new instance of AddTaskCommand.
Methods inherited from BaseCommand
Constructor Details
#initialize(client) ⇒ AddTaskCommand
Returns a new instance of AddTaskCommand.
109 110 111 112 113 |
# File 'lib/toodledo/command_line/add_command.rb', line 109 def initialize(client) super(client, 'add', false) self.short_desc = "Add a task" self.description = "Adds a task to Toodledo" end |
Instance Method Details
#execute(args) ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/toodledo/command_line/add_command.rb', line 115 def execute(args) return if (args == nil) Toodledo.begin(client.logger) do |session| line = args.join(' ') client.add_task(session, line) end return 0 rescue ItemNotFoundError => e puts e. return -1 end |