Sha256: 132556e30c35e3748a94953e72b80d56c48f80ca1a5d248dcf38dbbddada91ae

Contents?: true

Size: 730 Bytes

Versions: 31

Compression:

Stored size: 730 Bytes

Contents

require_relative 'common'

module Kontena::Cli::Grids
  class ListCommand < Clamp::Command
    include Kontena::Cli::Common
    include Common

    def execute
      require_api_url

      if grids['grids'].size == 0
        puts "You don't have any grids yet. Create first one with 'kontena grid create' command".colorize(:yellow)
      end

      puts '%-30.30s %-8s %-12s %-10s' % ['Name', 'Nodes', 'Services', 'Users']
      grids['grids'].each do |grid|
        if grid['id'] == current_grid
          name = "#{grid['name']} *"
        else
          name = grid['name']
        end
        puts '%-30.30s %-8s %-12s %-10s' % [name, grid['node_count'], grid['service_count'], grid['user_count']]
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
kontena-cli-0.14.1 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.14.0 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.13.4 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.13.3 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.13.2 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.13.1 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.13.0.1 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.13.0 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.12.3 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.12.2 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.12.1 lib/kontena/cli/grids/list_command.rb