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
86
87
88
89
90
|
# File 'lib/config_o_mat/meta_configurator/op/parse_meta_cli.rb', line 40
def call
self.early_exit = false
parser = OptionParser.new do |opts|
opts.on('-v', '--version', 'Display the version') do
self.early_exit = true
end
opts.on('-h', '--help', 'Prints this help') do
puts opts
self.early_exit = true
end
opts.on(
'-c', '--configuration-directory directory',
'Read configuration from the given directory instead of from $CONFIGURATION_DIRECTORY'
) do |dir|
self.configuration_directory = dir
end
opts.on(
'-r', '--runtime-directory directory',
'Use the given directory for writing templates instead of $RUNTIME_DIRECTORY'
) do |dir|
self.runtime_directory = dir
end
opts.on(
'-l', '--logs-directory directory',
'Use the given directory for writing log files instead of $LOGS_DIRECTORY'
) do |dir|
self.logs_directory = dir
end
opts.on(
'-s', '--systemd-directory directory',
"Write out systemd configuration to the given directory instead of #{DEFAULT_SYSTEMD_DIRECTORY}"
) do |dir|
self.systemd_directory = dir
end
end
parser.parse(argv)
self.configuration_directory ||= env['CONFIGURATION_DIRECTORY']
self.runtime_directory ||= env['RUNTIME_DIRECTORY']
self.logs_directory ||= env['LOGS_DIRECTORY']
self.systemd_directory ||= DEFAULT_SYSTEMD_DIRECTORY
self.configuration_directory = configuration_directory&.expand_path
end
|