5
6
7
8
9
10
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/jira_fix_version_release.rb', line 5
def self.parse(args)
options = {}
opt_parser = OptionParser.new do |opts|
opts.banner = "Usage: jira_fix_version_release [options]"
opts.separator " "
opts.separator "Specific options:"
opts.on("-h", "--help", "Displays help") do
puts opts
exit
end
opts.on("-u", "--username=USERNAME",
"JIRA username is required") do |username|
options[:username] = username
end
opts.on("-p", "--password=PASSWORD",
"JIRA password is required") do |password|
options[:password] = password
end
opts.on("-j", "--project_key=PROJECT_KEY",
"JIRA project key is required") do |project_key|
options[:project_key] = project_key
end
opts.on("-v", "--fix_version=FIX_VERSION",
"JIRA fix version is required") do |v|
options[:fix_version] = v
end
opts.on("-f", "--jql_filter=JQL_FILTER",
"JQL filter query is required") do |jql_filter|
options[:jql_filter] = jql_filter
end
opts.on("-d", "--jira_domain=JIRA_DOMAIN",
"JIRA domain is required") do |d|
options[:jira_domain] = d
end
opts.on("-c", "--commits",
"displays commit history") do |commits|
options[:commits] = commits
end
end.parse!
if options[:username] == nil
print 'Enter JIRA username: '
options[:username] = gets.chomp
end
if options[:password] == nil
options[:password] = `read -s -p "Enter JIRA password: " password; echo $password`.chomp
puts ""
end
if options[:project_key] == nil
print 'Enter JIRA project KEY: '
options[:project_key] = gets.chomp
end
if options[:fix_version] == nil
print 'Enter JIRA fix version: '
options[:fix_version] = gets.chomp
end
if options[:jira_domain] == nil
print 'Enter JIRA url: '
options[:jira_domain] = gets.chomp
end
if options[:jql_filter] == nil
print 'Enter JQL filter: '
options[:jql_filter] = gets.chomp
end
return options
end
|