class Unsub::Mjolnir

Thor's hammer! Like Thor with better logging

Constants

COMMON_OPTIONS

Common options for Thor commands

Public Class Methods

include_common_options() click to toggle source

Decorate Thor commands with the options above

# File lib/unsub/mjolnir.rb, line 33
def self.include_common_options
  COMMON_OPTIONS.each do |name, spec|
    option name, spec
  end
end

Public Instance Methods

log() click to toggle source

Construct a Logger given the command-line options

# File lib/unsub/mjolnir.rb, line 43
def log
  return @logger if defined? @logger
  @logger = Slog.new out: (options.log || $stdout), prettify: false
  @logger.level = :debug if options.debug?
  @logger.level = :trace if options.trace?
  @logger
end