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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/lsaws/cli.rb', line 27
def option_parser
@option_parser ||=
OptionParser.new do |opt|
opt.banner = "Usage: lsaws [options] <sdk> [entity_type]"
opt.on("--endpoint ENDPOINT", "AWS endpoint") do |o|
@options[:endpoint] = o
end
opt.on("--endpoint-url ENDPOINT", "AWS endpoint (aws cli compatible option)") do |o|
@options[:endpoint] = o
end
opt.on("-p", "--profile PROFILE", "AWS profile") do |o|
@options[:profile] = o
ENV['AWS_PROFILE'] = o
end
opt.on("-o", "--output FMT", SUPPORTED_FORMATS, "Format: #{SUPPORTED_FORMATS.join("/")}") do |f|
@options[:format] = f.to_sym
end
opt.on("--no-header", "Suppress header") { @options[:header] = false }
opt.on("-x", 'Shortcut for "-o text --no-header"') do
@options[:format] = :text
@options[:header] = false
end
opt.on("--tags", "Show tags") { @options[:show_tags] = true }
opt.on("-f", "--filter K=V", "Add filter") { |o| @options[:filters].merge!(Hash[*o.split("=", 2)]) }
opt.on("-C", "--columns C", "Show only specified column(s)") do |o|
if o[","]
@options[:show_cols].append(*o.split(","))
else
@options[:show_cols] << o
end
end
opt.on("--max-results N", Integer, "Fetch only specified number of results") do |o|
@options[:max_results] = o
end
opt.on("--max-width X", Integer, "max text width for table/text mode, default: auto") do |o|
@options[:max_width] = o
end
opt.separator ""
opt.on("-v", "--verbose", "Verbose output") { @options[:verbose] = true }
opt.on("--debug") { @options[:debug] = true }
opt.separator ""
opt.on("-L", "--list", "List SDKs or entity types") { @options[:list] = true }
opt.on("-A", "--all", "List all entity types within SDK") { @options[:all] = true }
end
end
|