Class: Tlog::Command::Create
Instance Attribute Summary
#date_time_format, #seconds_format, #storage
Instance Method Summary
collapse
Instance Method Details
#description ⇒ Object
8
9
10
|
# File 'lib/tlog/command/create.rb', line 8
def description
"creates a new time log either with no goal or with a goal"
end
|
#execute(input, output) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/tlog/command/create.rb', line 12
def execute(input, output)
raise Tlog::Error::CommandInvalid, "Must specify log name" unless input.args[0]
log = Tlog::Entity::Log.new
log.name = input.args[0];
create_log(log, input.options)
output.line("Created log '#{log.name}'")
end
|
#name ⇒ Object
4
5
6
|
# File 'lib/tlog/command/create.rb', line 4
def name
"create"
end
|
#options(parser, options) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/tlog/command/create.rb', line 21
def options(parser, options)
parser.banner = "usage: tlog create <log_name>"
parser.on("-g", "--goal <goal_length>") do |goal|
options[:goal] = goal
end
parser.on("-s", "--state <initial_state>") do |state|
options[:state] = state
end
parser.on("-p", "--points <initial_points_value>") do |points|
options[:points] = points
end
end
|