Class: Toodledo::CommandLine::DeleteContextCommand
- Inherits:
-
BaseCommand
- Object
- CmdParse::Command
- BaseCommand
- Toodledo::CommandLine::DeleteContextCommand
- Defined in:
- lib/toodledo/command_line/delete_command.rb
Instance Method Summary collapse
- #execute(args) ⇒ Object
-
#initialize(client) ⇒ DeleteContextCommand
constructor
A new instance of DeleteContextCommand.
Methods inherited from BaseCommand
Constructor Details
#initialize(client) ⇒ DeleteContextCommand
Returns a new instance of DeleteContextCommand.
20 21 22 23 |
# File 'lib/toodledo/command_line/delete_command.rb', line 20 def initialize(client) super(client, 'context', false) self.short_desc = "Deletes a context" end |
Instance Method Details
#execute(args) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/toodledo/command_line/delete_command.rb', line 25 def execute(args) Toodledo.begin(client.logger) do |session| line = args.join(' ') client.delete_context(session, line) end return 0 rescue ItemNotFoundError => e puts e. return -1 end |