Sha256: 97cc279c2541869a2e09e5ba5bfb2f41c96200c374316f5f7109a8ec3b291f99

Contents?: true

Size: 901 Bytes

Versions: 33

Compression:

Stored size: 901 Bytes

Contents

require_relative 'common'

module Kontena::Cli::Grids
  class RemoveCommand < Kontena::Command
    include Kontena::Cli::Common
    include Common

    parameter "NAME ...", "Grid name"
    option "--force", :flag, "Force remove", default: false, attribute_name: :forced

    def execute
      require_api_url
      token = require_token
      name_list.each do |name|
        confirm_command(name) unless forced?
        grid = find_grid_by_name(name)

        if !grid.nil?
          spinner "removing #{pastel.cyan(name)} grid " do
            response = client(token).delete("grids/#{grid['id']}")
            if response
              clear_current_grid if grid['id'] == current_grid
            end
          end
        else
          exit_with_error "Could not resolve grid by name [#{name}]. For a list of existing grids please run: kontena grid list"
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
krates-1.6.1 lib/kontena/cli/grids/remove_command.rb
krates-1.6.0 lib/kontena/cli/grids/remove_command.rb
kontena-cli-1.5.4 lib/kontena/cli/grids/remove_command.rb
kontena-cli-1.5.4.rc1 lib/kontena/cli/grids/remove_command.rb
kontena-cli-1.5.3 lib/kontena/cli/grids/remove_command.rb
kontena-cli-1.5.2 lib/kontena/cli/grids/remove_command.rb
kontena-cli-1.5.1 lib/kontena/cli/grids/remove_command.rb
kontena-cli-1.5.0 lib/kontena/cli/grids/remove_command.rb
kontena-cli-1.5.0.rc1 lib/kontena/cli/grids/remove_command.rb
kontena-cli-1.5.0.pre5 lib/kontena/cli/grids/remove_command.rb
kontena-cli-1.5.0.pre4 lib/kontena/cli/grids/remove_command.rb
kontena-cli-1.5.0.pre3 lib/kontena/cli/grids/remove_command.rb
kontena-cli-1.5.0.pre2 lib/kontena/cli/grids/remove_command.rb