Sha256: f5c81363c54288bca3e6db6cec0badcce25958fee66ca9347a48f30f7aa3daab

Contents?: true

Size: 619 Bytes

Versions: 158

Compression:

Stored size: 619 Bytes

Contents

require 'uri'

module Kontena::Cli::Master
  class CurrentCommand < Kontena::Command
    include Kontena::Cli::Common

    option ["--name"], :flag, "Show name only", default: false
    option ["--address"], :flag, "Show IP address or FQDN only", default: false
    option ["--url"], :flag, "Show URL only", default: false

    def execute
      master = require_current_master

      if name?
        puts master['name']
      elsif address?
        puts URI.parse(master['url']).host
      elsif url?
        puts master['url']
      else
        puts "#{master['name']} #{master['url']}"
      end
    end
  end
end

Version data entries

158 entries across 158 versions & 2 rubygems

Version Path
krates-1.7.11 lib/kontena/cli/master/current_command.rb
krates-1.7.10 lib/kontena/cli/master/current_command.rb
krates-1.7.9 lib/kontena/cli/master/current_command.rb
krates-1.7.8 lib/kontena/cli/master/current_command.rb
krates-1.7.7 lib/kontena/cli/master/current_command.rb
krates-1.7.6 lib/kontena/cli/master/current_command.rb
krates-1.7.5 lib/kontena/cli/master/current_command.rb
krates-1.7.4 lib/kontena/cli/master/current_command.rb
krates-1.7.3 lib/kontena/cli/master/current_command.rb
krates-1.7.2 lib/kontena/cli/master/current_command.rb
krates-1.7.1 lib/kontena/cli/master/current_command.rb
krates-1.7.0 lib/kontena/cli/master/current_command.rb
krates-1.6.9 lib/kontena/cli/master/current_command.rb
krates-1.6.8 lib/kontena/cli/master/current_command.rb
krates-1.6.7 lib/kontena/cli/master/current_command.rb
krates-1.6.6 lib/kontena/cli/master/current_command.rb
krates-1.6.5 lib/kontena/cli/master/current_command.rb
krates-1.6.4 lib/kontena/cli/master/current_command.rb
krates-1.6.3 lib/kontena/cli/master/current_command.rb
krates-1.6.2 lib/kontena/cli/master/current_command.rb