Class: Timelog::Command::ClientAdd

Inherits:
Timelog::Command show all
Defined in:
lib/timelog/command/client_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
# File 'lib/timelog/command/client_add.rb', line 4

def execute
  raise InvalidArgumentError if arguments.size > 2
  raise MissingClientNameError unless name = arguments.shift

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

#helpObject



12
13
14
# File 'lib/timelog/command/client_add.rb', line 12

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