Class: Toodledo::CommandLine::DeleteContextCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/toodledo/command_line/delete_command.rb

Instance Method Summary collapse

Methods inherited from BaseCommand

#client

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.message
  return -1
end