Class: Toodledo::CommandLine::EditCommand

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

Instance Method Summary collapse

Methods inherited from BaseCommand

#client

Constructor Details

#initialize(client) ⇒ EditCommand

Returns a new instance of EditCommand.



6
7
8
9
10
# File 'lib/toodledo/command_line/edit_command.rb', line 6

def initialize(client)
  super(client, 'edit', false)
  self.short_desc = "Edit a task"
  self.description = "Edits a task in toodledo."
end

Instance Method Details

#execute(args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/toodledo/command_line/edit_command.rb', line 12

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