11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/ticgit-ng/command/new.rb', line 11
def execute
if title = options.title
ticket_show(tic.ticket_new(title, options.to_hash))
else
prompt = "\n# ---\ntags:\n"
prompt += "# first line will be the title of the tic, the rest will be the first comment\n"
prompt += "# if you would like to add initial tags, put them on the 'tags:' line, comma delim"
if message = get_editor_message(prompt)
title = message.shift
if title && title.chomp.length > 0
title = title.chomp
if message.last[0, 5] == 'tags:'
tags = message.pop
tags = tags.gsub('tags:', '')
tags = tags.split(',').map { |t| t.strip }
end
if message.size > 0
= message.join("")
end
ticket_show(tic.ticket_new(title, :comment => , :tags => tags))
else
puts "You need to at least enter a title"
end
else
puts "It seems you wrote nothing"
end
end
end
|