Class: Toodledo::CommandLine::DeleteTaskCommand
- Inherits:
-
BaseCommand
- Object
- CmdParse::Command
- BaseCommand
- Toodledo::CommandLine::DeleteTaskCommand
- Defined in:
- lib/toodledo/command_line/delete_command.rb
Instance Method Summary collapse
- #execute(args) ⇒ Object
-
#initialize(client) ⇒ DeleteTaskCommand
constructor
A new instance of DeleteTaskCommand.
Methods inherited from BaseCommand
Constructor Details
#initialize(client) ⇒ DeleteTaskCommand
Returns a new instance of DeleteTaskCommand.
77 78 79 80 81 |
# File 'lib/toodledo/command_line/delete_command.rb', line 77 def initialize(client) super(client, 'delete', false) self.short_desc = "Deletes a task" self.description = "Deletes a task from Toodledo." end |
Instance Method Details
#execute(args) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/toodledo/command_line/delete_command.rb', line 83 def execute(args) Toodledo.begin(client.logger) do |session| line = args.join(' ') client.delete_task(session, line) end return 0 rescue ItemNotFoundError => e puts e. return -1 end |