Module: Terraformw

Defined in:
lib/terraformw.rb,
lib/terraformw/version.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.startObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/terraformw.rb', line 7

def start
  cmd_ws_list = `terraform workspace list`

  cmd_result = cmd_ws_list.split(/\r\n|\r|\n/)
  ws_list = cmd_result.map do |workspace|
    workspace_ = workspace.delete("¥*")
    workspace_.strip
  end

  prompt = TTY::Prompt.new(interrupt: :exit)
  ws = prompt.select("Select WorkSpace", ws_list)

  `terraform workspace select #{ws}`
end