Sha256: 8f1acb209d5d5827f5b72ad859d444c37f1d2aba09aff817df9172d20c30280f

Contents?: true

Size: 941 Bytes

Versions: 7

Compression:

Stored size: 941 Bytes

Contents

require 'lino'
require_relative 'base'

module RubyTerraform
  module Commands
    class Destroy < Base
      def configure_command(builder, opts)
        directory = opts[:directory]
        vars = opts[:vars] || {}
        state = opts[:state]
        force = opts[:force]
        no_backup = opts[:no_backup]
        backup = no_backup ? '-' : opts[:backup]
        no_color = opts[:no_color]

        builder
            .with_subcommand('destroy') do |sub|
              vars.each do |key, value|
                sub = sub.with_option('-var', "'#{key}=#{value}'", separator: ' ')
              end
              sub = sub.with_option('-state', state) if state
              sub = sub.with_option('-backup', backup) if backup
              sub = sub.with_flag('-no-color') if no_color
              sub = sub.with_flag('-force') if force
              sub
            end
            .with_argument(directory)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ruby-terraform-0.7.0 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.6.0 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.5.1 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.5.0 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.4.0 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.3.0 lib/ruby_terraform/commands/destroy.rb
ruby-terraform-0.2.0 lib/ruby_terraform/commands/destroy.rb