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
|
# File 'lib/gemsurance/cli.rb', line 6
def parse(*argv)
options = {}
opts = OptionParser.new do |opts|
opts.banner = "Usage: gemsurance [options]"
opts.separator ""
opts.separator "Options:"
opts.on("--pre", "Consider pre-release gem versions") do |lib|
options[:pre] = true
end
opts.on("--fail-outdated", "Returns exit code 2 if any gems are outdated") do |lib|
options[:fail_outdated] = true
end
opts.on("--output FILE", "Output report to given file") do |file|
options[:output_file] = file
end
opts.on('--whitelist FILE', 'Read whitelist from file. Defaults to .gemsurance.yml') do |file|
options[:whitelist_file] = file
end
opts.on("--format FORMAT", "Output report to given format (html, csv, and yml available). html by default.") do |format|
options[:formatter] = format
unless %w(html csv yml).include?(options[:formatter])
puts "Invalid formatter. Possible values are html, csv, and yml."
exit 1
end
end
opts.on_tail("-h", "--help", "Show this help") do
puts opts
exit
end
opts.on_tail("--version", "Show version") do
puts "Gemsurance version #{Gemsurance::VERSION}"
exit
end
end
opts.parse!(argv)
options
end
|