Class: Timelog::Command::ProjectAdd

Inherits:
Timelog::Command show all
Defined in:
lib/timelog/command/project_add.rb

Instance Attribute Summary

Attributes inherited from Timelog::Command

#arguments, #book, #session

Instance Method Summary collapse

Methods inherited from Timelog::Command

get, inherited, #initialize, known, register, #time_in_arguments

Constructor Details

This class inherits a constructor from Timelog::Command

Instance Method Details

#executeObject

Raises:

  • (InvalidArgumentError)


4
5
6
7
8
9
10
11
# File 'lib/timelog/command/project_add.rb', line 4

def execute
  raise InvalidArgumentError if arguments.size > 3
  raise MissingClientNameError unless client = arguments.shift
  raise MissingProjectNameError unless name = arguments.shift

  book.projects.add client, name, arguments.shift
  "project #{name} added"
end

#helpObject



13
14
15
# File 'lib/timelog/command/project_add.rb', line 13

def help
  "usage: timelog project add <client> <name> [<shortcut>]"
end