Sha256: 537b14043a9f166ada56f9f6e4261b3f0bb3edd6baecf7961814f6f59bf313c0

Contents?: true

Size: 595 Bytes

Versions: 24

Compression:

Stored size: 595 Bytes

Contents

module Kontena::Cli::Master
  class ListCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::TableGenerator::Helper

    def fields
      @fields ||= quiet? ? %w(name) : %w(name url)
    end

    def current_master_name
      @current_master_name ||= current_master.nil? ? nil : current_master.name
    end

    def mark_if_current(row)
      unless quiet?
        row.name.insert(0, pastel.yellow('* ')) if row.name == current_master_name
      end
    end

    def execute
      print_table(config.servers, fields, &method(:mark_if_current))
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
kontena-cli-1.3.5 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.5.rc1 lib/kontena/cli/master/list_command.rb
kontena-cli-1.4.0.pre6 lib/kontena/cli/master/list_command.rb
kontena-cli-1.4.0.pre5 lib/kontena/cli/master/list_command.rb
kontena-cli-1.4.0.pre4 lib/kontena/cli/master/list_command.rb
kontena-cli-1.4.0.pre3 lib/kontena/cli/master/list_command.rb
kontena-cli-1.4.0.pre2 lib/kontena/cli/master/list_command.rb
kontena-cli-1.4.0.pre1 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.4 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.4.rc1 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.3 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.3.rc1 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.2 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.2.rc2 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.2.rc1 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.1 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.1.rc2 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.1.rc1 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.0 lib/kontena/cli/master/list_command.rb
kontena-cli-1.3.0.rc4 lib/kontena/cli/master/list_command.rb