Sha256: 935cae5adbc812e75ab8d19a55e71087003a079d920681f0b478fa571020ae7d

Contents?: true

Size: 804 Bytes

Versions: 22

Compression:

Stored size: 804 Bytes

Contents

require_relative 'common'

module Kontena::Cli::Grids
  class RemoveCommand < Clamp::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
      confirm_command(name) unless forced?
      grid = find_grid_by_name(name)

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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kontena-cli-0.15.5 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.5.rc2 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.5.rc1 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.4 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.4.rc2 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.4.rc1 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.4.pre1 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.3 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.2 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.1 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.0 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.0.rc3 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.0.rc2 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.15.0.rc1 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.14.7 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.14.6 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.14.5 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.14.4 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.14.3 lib/kontena/cli/grids/remove_command.rb
kontena-cli-0.14.2 lib/kontena/cli/grids/remove_command.rb