Class: Unsub::Mjolnir

Inherits:
Thor
  • Object
show all
Defined in:
lib/unsub/mjolnir.rb

Overview

Thor’s hammer! Like Thor with better logging

Direct Known Subclasses

Main

Constant Summary collapse

COMMON_OPTIONS =

Common options for Thor commands

{
  log: {
    type: :string,
    aliases: %w[ -l ],
    desc: 'Log to file instead of STDOUT',
    default: ENV['UNSUB_LOG'] || nil
  },
  debug: {
    type: :boolean,
    aliases: %w[ -v ],
    desc: 'Enable DEBUG-level logging',
    default: ENV['UNSUB_DEBUG'] || false
  },
  trace: {
    type: :boolean,
    aliases: %w[ -z ],
    desc: 'Enable TRACE-level logging',
    default: ENV['UNSUB_TRACE'] || false
  }
}

Class Method Summary collapse

Class Method Details

.include_common_optionsObject

Decorate Thor commands with the options above



33
34
35
36
37
# File 'lib/unsub/mjolnir.rb', line 33

def self.include_common_options
  COMMON_OPTIONS.each do |name, spec|
    option name, spec
  end
end