lib/simple_deploy/cli/attributes.rb in simple_deploy-0.6.4 vs lib/simple_deploy/cli/attributes.rb in simple_deploy-0.6.5
- old
+ new
@@ -2,10 +2,12 @@
module SimpleDeploy
module CLI
class Attributes
+ include Shared
+
def show
@opts = Trollop::options do
version SimpleDeploy::VERSION
banner <<-EOS
@@ -21,19 +23,26 @@
opt :log_level, "Log level: debug, info, warn, error", :type => :string,
:default => 'info'
opt :name, "Stack name to manage", :type => :string
end
- CLI::Shared.valid_options? :provided => @opts,
- :required => [:environment, :name]
+ valid_options? :provided => @opts,
+ :required => [:environment, :name]
@opts[:as_command_args] ? command_args_output : default_output
end
+ def command_summary
+ 'Show attributes for stack'
+ end
+
private
+
def attribute_data
- Hash[stack.attributes.sort]
+ rescue_stackster_exceptions_and_exit do
+ Hash[stack.attributes.sort]
+ end
end
def command_args_output
puts attribute_data.map { |k, v| "-a #{k}=#{v}" }.join(' ')
end
@@ -41,10 +50,10 @@
def config
@config ||= Config.new.environment @opts[:environment]
end
def default_output
- attribute_data.each_pair { |k, v| puts "#{k}=#{v}" }
+ attribute_data.each_pair { |k, v| puts "#{k}: #{v}" }
end
def logger
@logger ||= SimpleDeployLogger.new :log_level => @opts[:log_level]
end