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
48
49
|
# File 'lib/tane/parser.rb', line 13
def parse(args)
options = OpenStruct.new
options.scheme = "http"
options.host = "localhost"
options.port = 3000
options.inplace = false
options.encoding = "utf8"
options.transfer_type = :auto
options.verbose = false
global_option :port, '-p', '--port PORT', Integer, "The port your local Cloudfuji app is running on"
global_option :host, '-n', '--host HOST', String, "The hostname where your local Cloudfuji app is running"
global_option :scheme, '-s', '--scheme SCHEME', String, "Either http or https, whichever protocol your local Cloudfuji app is using"
global_option :verbose, '-V', '--verbose', "Output a lot of noise"
opts = OptionParser.new do |opts|
banner = "Usage: tane command [options]\n"
banner += Tane::Commands.command_list_and_help
opts.banner = banner
opts.separator ""
opts.separator "Specific options:"
global_options.each do |option|
opts.on(option[:name].to_s, *option[:args]) do |value|
options.send("#{option[:name]}=", value)
end
end
options.send("help_text=", opts.help())
opts.parse!(args)
return options
end
end
|