Class: FluidCLI::Commands::Whoami

Inherits:
FluidCLI::Command show all
Defined in:
lib/fluid_cli/commands/whoami.rb

Instance Attribute Summary

Attributes inherited from FluidCLI::Command

#ctx, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FluidCLI::Command

call, call_help, #initialize, options, subcommand, subcommand_registry

Constructor Details

This class inherits a constructor from FluidCLI::Command

Class Method Details

.helpObject



18
19
20
# File 'lib/fluid_cli/commands/whoami.rb', line 18

def self.help
  "Displays the currently logged in company."
end

Instance Method Details

#call(_args, _name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fluid_cli/commands/whoami.rb', line 6

def call(_args, _name)
  company = FluidCLI::DB.get(:company)
  company_name = FluidCLI::DB.get(:company_name)

  output = if company.nil?
    "Not logged in to any company."
  else
    "Logged in to company: #{company_name || company}"
  end
  @ctx.puts(output)
end