Class: Terraspace::CLI::New::Arg

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/terraspace/cli/new/arg.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.optionsObject



7
8
9
10
11
12
13
# File 'lib/terraspace/cli/new/arg.rb', line 7

def self.options
  [
    [:force, aliases: %w[y], type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
    [:name, default: "apply", desc: "command name"],
    [:type, default: "project", desc: "project, stack or module"],
  ]
end

.source_rootObject



16
17
18
# File 'lib/terraspace/cli/new/arg.rb', line 16

def self.source_root
  File.expand_path("../../../templates/base/arg", __dir__)
end

Instance Method Details

#check_stack_argObject



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/terraspace/cli/new/arg.rb', line 46

def check_stack_arg
  return if type == "project"
  return unless stack.nil?
  # Else check for STACK argument for type module or stack
  puts <<~EOL
    Required STACK argument, either the module or stack name. Usage:

        terraspace new arg STACK --type #{type}
  EOL
  exit 1
end

#createObject



58
59
60
# File 'lib/terraspace/cli/new/arg.rb', line 58

def create
  directory ".", dest
end