Sha256: ec6cf1c5fc0273a7e1d62193d8082878e6fb966543fc9a7c63e053faaa79ddc1

Contents?: true

Size: 911 Bytes

Versions: 15

Compression:

Stored size: 911 Bytes

Contents

require 'lino'
require 'stringio'
require_relative 'base'

module RubyTerraform
  module Commands
    class Output < Base
      def stdout
        @stdout = StringIO.new unless
            defined?(@stdout) && @stdout.respond_to?(:string)
      end

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

        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 = sub.with_option('-module', mod) if mod
              sub
            end
        builder = builder.with_argument(name) if name
        builder
      end

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ruby-terraform-0.39.0.pre.pre.1 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.38.0 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.37.0.pre.pre.1 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.36.0 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.35.0.pre.pre.2 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.35.0.pre.pre.1 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.34.0 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.33.0.pre.pre.1 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.32.0 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.31.0.pre.pre.3 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.31.0.pre.pre.2 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.31.0.pre.pre.1 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.30.0 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.29.0.pre.pre.2 lib/ruby_terraform/commands/output.rb
ruby-terraform-0.29.0.pre.pre.1 lib/ruby_terraform/commands/output.rb