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
|
# File 'lib/wiot-agent-hd/cli.rb', line 7
def self.parse_options(args=ARGV)
options = {api_key: nil, space: nil, project: nil}
parser = OptionParser.new do|opts|
opts.banner = "Usage: wiot-agent-hd [options]"
opts.on('-a', '--api-key api_key', 'The API Key') do |api_key|
options[:api_key] = api_key;
end
opts.on('-s', '--space space', 'The Space') do |space|
options[:space] = space;
end
opts.on('-p', '--project project', 'The Project') do |project|
options[:project] = project;
end
opts.on_tail('-h', '--help', 'Displays Help') do
puts opts
exit
end
opts.on_tail('-v', '--version', 'Show version') do
puts WiotAgentHd::VERSION
exit
end
end
parser.parse!(args)
options
end
|