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.15.5 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.5.rc2 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.5.rc1 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.4 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.4.rc2 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.4.rc1 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.4.pre1 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.3 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.2 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.1 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.0 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.0.rc3 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.0.rc2 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.15.0.rc1 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.14.7 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.14.6 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.14.5 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.14.4 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.14.3 lib/kontena/cli/grids/list_command.rb
kontena-cli-0.14.2 lib/kontena/cli/grids/list_command.rb