Class: Tlog::Command::Delete

Inherits:
Tlog::Command show all
Defined in:
lib/tlog/command/delete.rb

Instance Attribute Summary

Attributes inherited from Tlog::Command

#date_time_format, #seconds_format, #storage

Instance Method Summary collapse

Instance Method Details

#descriptionObject



7
8
9
# File 'lib/tlog/command/delete.rb', line 7

def description
  "deletes a time log"
end

#execute(input, output) ⇒ Object



11
12
13
14
# File 'lib/tlog/command/delete.rb', line 11

def execute(input, output)
  raise Tlog::Error::CommandInvalid, "Task does not exist" unless delete(input.args[0])
  output.line("Deleted log '#{input.args[0]}'")
end

#nameObject



3
4
5
# File 'lib/tlog/command/delete.rb', line 3

def name
  "delete"
end

#options(parser, options) ⇒ Object



16
17
18
# File 'lib/tlog/command/delete.rb', line 16

def options(parser, options)
  parser.banner = "usage: tlog delete <tlog_name>"
end