Class: Locd::CLI::Command::Main

Inherits:
Base
  • Object
show all
Includes:
Thor::Completion::Bash
Defined in:
lib/locd/cli/command/main.rb

Overview

CLI interface using the Thor via my atli fork.

Constant Summary collapse

LOG_LEVEL_STRINGS =

Just the symbol log levels from SemnaticLogger::LEVELS converted to frozen strings

Returns:

  • (Array<String>)
SemanticLogger::LEVELS.map { |sym| sym.to_s.freeze }

Instance Method Summary collapse

Constructor Details

#initialize(args = [], local_options = {}, config = {}) ⇒ Main

Wrap Thor#initialize to call #init_setup_logging after letting super do it's thing so logging is setup before we do anything else.



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/locd/cli/command/main.rb', line 105

def initialize args = [], local_options = {}, config = {}
  super args, local_options, config
  
  # If anything raises in here, the command seems to just silently exit..?
  begin
    init_setup_logging!
  rescue Exception => e
    $stderr.write \
      "ERROR: #{ e.message } #{ e.class }\n#{ e.backtrace.join( "\n" ) }\n"
  end
  
  logger.debug "initialized",
    args: args,
    local_options: local_options,
    options: self.options
  
end

Instance Method Details

#configObject



197
198
199
# File 'lib/locd/cli/command/main.rb', line 197

def config
  respond Locd.config.to_h
end

#versionObject



186
187
188
# File 'lib/locd/cli/command/main.rb', line 186

def version
  respond Locd::VERSION
end