Sha256: 6224f84c2be6573c19cfe9f5d051d3fc561f7dd96a53d9520949e5e966684685

Contents?: true

Size: 984 Bytes

Versions: 15

Compression:

Stored size: 984 Bytes

Contents

class Kontena::Cli::WhoamiCommand < Clamp::Command
  include Kontena::Cli::Common

  option '--bash-completion-path', :flag, 'Show bash completion path', hidden: true

  def execute
    if bash_completion_path?
      puts File.realpath(File.join(__dir__, '../scripts/init'))
      exit 0
    end

    require_api_url
    puts "Master: #{self.current_master['name']}"
    puts "URL: #{api_url}"
    puts "Grid: #{current_grid}"
    if current_master['email']
      puts "User: #{current_master['email']}"
    else # In case local storage doesn't have the user email yet
      token = require_token
      user = client(token).get('user')
      puts "User: #{user['email']}"
      master = {
          'name' => current_master['name'],
          'url' => current_master['url'],
          'token' => current_master['token'],
          'email' => user['email'],
          'grid' => current_master['grid']
      }

      self.add_master(current_master['name'], master)
    end


  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kontena-cli-0.15.0.rc1 lib/kontena/cli/whoami_command.rb
kontena-cli-0.14.7 lib/kontena/cli/whoami_command.rb
kontena-cli-0.14.6 lib/kontena/cli/whoami_command.rb
kontena-cli-0.14.5 lib/kontena/cli/whoami_command.rb
kontena-cli-0.14.4 lib/kontena/cli/whoami_command.rb
kontena-cli-0.14.3 lib/kontena/cli/whoami_command.rb
kontena-cli-0.14.2 lib/kontena/cli/whoami_command.rb
kontena-cli-0.14.1 lib/kontena/cli/whoami_command.rb
kontena-cli-0.14.0 lib/kontena/cli/whoami_command.rb
kontena-cli-0.13.4 lib/kontena/cli/whoami_command.rb
kontena-cli-0.13.3 lib/kontena/cli/whoami_command.rb
kontena-cli-0.13.2 lib/kontena/cli/whoami_command.rb
kontena-cli-0.13.1 lib/kontena/cli/whoami_command.rb
kontena-cli-0.13.0.1 lib/kontena/cli/whoami_command.rb
kontena-cli-0.13.0 lib/kontena/cli/whoami_command.rb