Class: RubyTerraform::Commands::Output

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

Instance Attribute Summary

Attributes inherited from Base

#binary

Instance Method Summary collapse

Methods inherited from Base

#do_before, #execute, #initialize, #instantiate_builder, #stderr, #stdin

Constructor Details

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

Instance Method Details

#configure_command(builder, opts) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ruby_terraform/commands/output.rb', line 11

def configure_command(builder, opts)
  name = opts[:name]
  state = opts[:state]
  no_color = opts[:no_color]

  builder = builder
      .with_subcommand('output') do |sub|
        sub = sub.with_flag('-no-color') if no_color
        sub = sub.with_option('-state', state) if state
        sub
      end
  builder = builder.with_argument(name) if name
  builder
end

#do_after(opts) ⇒ Object



26
27
28
29
# File 'lib/ruby_terraform/commands/output.rb', line 26

def do_after(opts)
  result = stdout.string
  opts[:name] ? result.chomp : result
end

#stdoutObject



7
8
9
# File 'lib/ruby_terraform/commands/output.rb', line 7

def stdout
  @stdout ||= StringIO.new
end