Method: WavefrontCli::OptHandler#initialize

Defined in:
lib/wavefront-cli/opt_handler.rb

#initialize(cli_opts = {}) ⇒ OptHandler

Returns a new instance of OptHandler.



30
31
32
33
34
35
36
37
38
# File 'lib/wavefront-cli/opt_handler.rb', line 30

def initialize(cli_opts = {})
  cred_opts = setup_cred_opts(cli_opts)
  cli_opts.reject! { |_k, v| v.nil? }
  @opts = DEFAULT_OPTS.merge(load_profile(cred_opts)).merge(cli_opts)
rescue WavefrontCli::Exception::ConfigFileNotFound => e
  abort "Configuration file '#{e}' not found."
rescue Wavefront::Exception::InvalidConfigFile => e
  abort "Could not load configuration file '#{e.message}'."
end