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
|
# File 'lib/consult/cli.rb', line 25
def parse_options(argv)
opts = {
config_dir: Dir.pwd,
force_render: true,
verbose: true
}
@parser = OptionParser.new do |o|
o.on '-d', '--directory=DIR', 'Path to directory containing the config directory' do |arg|
opts[:config_dir] = arg
end
o.on '-f', '--[no-]force', TrueClass, 'Ignore template TTLs and force rendering' do |arg|
opts[:force_render] = arg
end
o.on '--quiet', FalseClass, 'Silence output' do |arg|
opts[:verbose] = arg
end
o.on '--version', 'Show version' do
puts "Consult #{Consult::VERSION}"
exit 0
end
end
@parser.on_tail "-h", "--help", "Show help" do
puts @parser
exit 1
end
@parser.parse! argv
opts
end
|