24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/ptf/commands/task/create.rb', line 24
def create(t, g, d, e)
title = t
group = g
due_date = d
estimate = e
if group.nil?
group = Ptf::Group.default_group
else
if Ptf::Group.group_exist? group
group = Ptf::Group.get_group group
else
return "Group #{p} does not exist. Create it with ptf group add GROUP ABBREVIATION"
end
end
if !due_date.nil?
due_date = Ptf::Date.create_datetime_from_str(due_date)
if due_date.nil?
return "Improperly formatted due date '#{d}' given."
end
end
id = new_id_number
info_file = Ptf::MetadataFile.create_from_input(title, group, due_date, estimate, id)
task_info_hash = generate_hash info_file.file_string
info_file.add_content(:hash, task_info_hash)
data_file = Ptf::DataFile.new(info_file)
info_file.write_to_file
data_file.write_to_file
return "Task #{info_file.id} created successfully."
end
|