fluke/devops-client/lib/devops-client/options/stack_template_options.rb
2015-12-15 18:56:14 +03:00

36 lines
1.0 KiB
Ruby

require "devops-client/options/common_options"
class StackTemplateOptions < CommonOptions
commands :create, :delete, :list, :show, :update_url
def initialize args, def_options
super(args, def_options)
self.header = I18n.t("headers.stack_template")
self.banner_header = "stack_template"
self.list_params = ["[provider]", "[ec2|openstack]"]
self.show_params = ["STACK_TEMPLATE"]
self.delete_params = ["STACK_TEMPLATE"]
self.update_url_params = ["STACK_TEMPLATE"]
end
def create_options
self.options do |parser, options|
parser.banner << self.create_banner
parser.recognize_option_value(:provider, 'stack_template', default: nil)
parser.recognize_option_value(:id, 'stack_template')
parser.recognize_option_value(:template_file, 'stack_template')
end
end
extend_options_method :list_options do |options|
if args[2] == "provider" and args[3]
options[:given_provider] = args[3]
elsif args[2]
options[:given_provider] = args[2]
end
end
end