Sha256: 1429e26b11f35dd3c6c229f8d05d207daa7fc2c9f3bb211796d0ff5d7fa66d36

Contents?: true

Size: 1.15 KB

Versions: 26

Compression:

Stored size: 1.15 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[:from_module]
        path = opts[:path]
        plugin_dir = opts[:plugin_dir]

        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_option('-from-module', source) if source
              sub = sub.with_flag('-no-color') if no_color
              sub = sub.with_option('-plugin-dir', plugin_dir) unless plugin_dir.nil?
              backend_config.each do |key, value|
                sub = sub.with_option(
                    '-backend-config',
                    "'#{key}=#{value}'",
                    separator: ' ')
              end
              sub
            end

        builder = builder.with_argument(path) if path

        builder
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
ruby-terraform-0.16.0 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.15.1.pre.1 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.15.1.pre2 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.15.1.pre1 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.15.0 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.14.1.pre1 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.2.pre42 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.2.pre41 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.2.pre40 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.14.0 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.2.pre39 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.2.pre38 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.2.pre37 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.2.pre36 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.2.pre35 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.2.pre34 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.2.pre33 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.2.pre32 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.2.pre31 lib/ruby_terraform/commands/init.rb
ruby-terraform-0.13.1 lib/ruby_terraform/commands/init.rb