class Sfctl::Commands::Time::Providers::Get

Public Class Methods

new(options) click to toggle source
# File lib/sfctl/commands/time/providers/get.rb, line 9
def initialize(options)
  @options = options
  @pastel = Pastel.new(enabled: !@options['no-color'])
end

Public Instance Methods

execute(output: $stdout) click to toggle source
# File lib/sfctl/commands/time/providers/get.rb, line 14
def execute(output: $stdout)
  return unless config_present?(output)

  PROVIDERS_LIST.each do |provider|
    read(provider, output)
  end
end

Private Instance Methods

read(provider, output) click to toggle source
# File lib/sfctl/commands/time/providers/get.rb, line 24
def read(provider, output)
  info = config.fetch("providers.#{provider}")
  if info.nil?
    output.puts @pastel.yellow("Provider #{provider} is not set.")
  else
    output.puts "Provider: #{@pastel.cyan(provider)}"
    info.each_key do |k|
      output.puts "  #{k.upcase}: #{@pastel.magenta(info[k])}"
    end
  end
end