Sha256: 2b7b12b5a92377fc3c103310c293c08392cbaea88f13aae67e5a79d592a51cd4

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

require 'lino'
require_relative 'base'

module RubyTerraform
  module Commands
    class Init < Base
      def configure_command(builder, opts)
        no_color = opts[:no_color]
        backend = opts[:backend]
        get = opts[:get]
        backend_config = opts[:backend_config] || {}
        source = opts[:source]
        path = opts[:path]

        builder = builder
            .with_subcommand('init') do |sub|
              sub = sub.with_option('-backend', backend) unless backend.nil?
              sub = sub.with_option('-get', get) unless get.nil?
              sub = sub.with_flag('-no-color') if no_color
              backend_config.each do |key, value|
                sub = sub.with_option(
                    '-backend-config',
                    "'#{key}=#{value}'",
                    separator: ' ')
              end
              sub
            end

        builder = builder.with_argument(source) if source
        builder = builder.with_argument(path) if path

        builder
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-terraform-0.8.0 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.7.0 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.6.0 lib/ruby_terraform/commands/init.rb