Class: RubyTerraform::Commands::Workspace

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_terraform/commands/workspace.rb

Instance Method Summary collapse

Methods inherited from Base

#execute, #initialize

Constructor Details

This class inherits a constructor from RubyTerraform::Commands::Base

Instance Method Details

#configure_command(builder, opts) ⇒ Object



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

def configure_command(builder, opts)
  directory = opts[:directory] || nil
  operation = opts[:operation] || 'list'
  workspace = opts[:workspace] || nil

  builder = builder
      .with_subcommand('workspace')
      .with_subcommand(operation)

  builder = builder.with_subcommand(workspace) if
      workspace && operation != 'list'
  builder = builder.with_argument(directory)

  builder
end