Class: Toodledo::CommandLine::DeleteGoalCommand

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) ⇒ DeleteGoalCommand

Returns a new instance of DeleteGoalCommand.



58
59
60
61
# File 'lib/toodledo/command_line/delete_command.rb', line 58

def initialize(client)
  super(client, 'goal', false)
  self.short_desc = "Deletes a goal"
end

Instance Method Details

#execute(args) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/toodledo/command_line/delete_command.rb', line 63

def execute(args)       
  Toodledo.begin(client.logger) do |session|            
    line = args.join(' ')
    client.delete_goal(session, line)
  end
  
  return 0
rescue ItemNotFoundError => e
  puts e.message
  return -1
end