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
|
# File 'lib/command_line.rb', line 6
def self.parse!(options)
OptionParser.new do |opts|
opts.banner = 'Usage: probium my_policy.yaml [options]'
opts.on('-o', '--output-format=FORMAT', 'Format in which to display policy report (graphic, json, yaml, csv)') do |of|
if VALID_OUTPUT_FORMATS.include?(f = of.downcase.to_sym)
options[:output_format] = f
else
options[:message] = "Invalid output-format '#{of}'. Options are #{VALID_OUTPUT_FORMATS.join(', ')}"
options[:state] = :fail
end
end
opts.on('-e', '--extension-dir=PATH', 'Location of extension files') do |path|
options[:extensions_path] = path
end
opts.on('-d', '--debug', 'Enable debug output') do
options[:debug] = true
end
opts.on('--no-color', 'Disable color in output') do
options[:color] = false
end
opts.on('-h', '--help', 'Print this help') do
options[:message] = opts
options[:state] = :exit
end
end.parse!
options
end
|