lib/bora/cli.rb in bora-1.4.1 vs lib/bora/cli.rb in bora-1.5.0
- old
+ new
@@ -1,10 +1,13 @@
require "thor"
require "bora"
+require "bora/cli_base"
+require "bora/cli_change_set"
class Bora
- class Cli < Thor
+ class Cli < CliBase
+
class_option :file,
type: :string,
aliases: :f,
default: Bora::DEFAULT_CONFIG_FILE,
desc: "The Bora config file to use"
@@ -89,35 +92,10 @@
option :params, type: :array, aliases: :p, desc: "Parameters to be passed to the template, eg: --params 'instance_type=t2.micro'"
def validate(stack_name)
stack(options.file, stack_name).validate(params)
end
-
- private
-
- def stack(config_file, stack_name)
- region = options.region
- cfn_stack_name = options["cfn-stack-name"]
-
- override_config = {}
- override_config["default_region"] = region if region
- override_config["cfn_stack_name"] = cfn_stack_name if cfn_stack_name
-
- bora = bora(config_file, override_config)
- stack = bora.stack(stack_name)
- if !stack
- STDERR.puts "Could not find stack #{stack_name}"
- exit(1)
- end
- stack
- end
-
- def bora(config_file, override_config = {})
- Bora.new(config_file_or_hash: config_file, override_config: override_config)
- end
-
- def params
- options.params ? Hash[options.params.map { |param| param.split("=", 2) }] : {}
- end
+ desc "changeset SUBCOMMAND ...ARGS", "Manage CloudFormation change sets"
+ subcommand "changeset", CliChangeSet
end
end