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
|
# File 'lib/opzworks/commands/cmd.rb', line 15
def self.run
options = Trollop.options do
banner <<-EOS.unindent
#{CMD.banner}
opzworks cmd [--list-stacks]
Options:
EOS
opt :'list-stacks', 'List all our stacks', default: false
end
config = OpzWorks.config
client = Aws::OpsWorks::Client.new(region: config.aws_region, profile: config.aws_profile)
if options[:'list-stacks']
list = []
response = client.describe_stacks
response[:stacks].each { |stack| list << stack[:name] }
puts list.sort
else
puts 'No options specified'.foreground(:yellow)
end
end
|