5
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
|
# File 'lib/claws/options.rb', line 5
def self.parse
options = OpenStruct.new(
{
:config_file => nil,
:connect => true,
:initialize => false,
:version => false,
:selection => nil,
:source => 'ec2',
}
)
OptionParser.new do |opts|
opts.banner = 'Usage: claws [options]'
opts.on('-d', '--display-only', 'Display host status only and exit') do
options.connect = false
end
opts.on('-c', '--choice N', Float, 'Enter the number of the host to automatically connect to') do |n|
options.selection = n.to_i
end
opts.on('-i', '--init', 'Install the default configuration file for the application') do
options.initialize = true
end
opts.on('-s', '--source S', String, 'define the AWS source - default is ec2') do |source|
options.source = source
end
opts.on('-v', '--version', 'Display the version number and exit') do
options.version = true
end
end.parse!
unless ARGV.empty?
options.environment = ARGV.shift
options.role = ARGV.shift
end
options
end
|