class FerrisBueller::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/ferris-bueller/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/ferris-bueller/mjolnir.rb, line 43 def log return @logger if defined? @logger device = options.log || $stdout colorize, prettify = false, false colorize, prettify = true, true if device.tty? rescue false @logger = Slog.new \ out: device, colorize: colorize, prettify: prettify @logger.level = :debug if options.debug? @logger.level = :trace if options.trace? @logger end