Module: Tomo::CLI::CommonOptions

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ Object

rubocop:disable Metrics/MethodLength



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/tomo/cli/common_options.rb', line 6

def self.included(mod) # rubocop:disable Metrics/MethodLength
  mod.class_eval do
    option :color, "--[no-]color", "Enable/disable color output" do |color|
      Colors.enabled = color
    end
    option :debug, "--[no-]debug", "Enable/disable verbose debug logging" do |debug|
      Tomo.debug = debug
    end
    option :quiet, "--[no-]quiet", "Silence all progress output" do |quiet|
      Tomo.quiet = quiet
    end
    option :trace, "--[no-]trace", "Display full backtrace on error" do |trace|
      CLI.show_backtrace = trace
    end
    option :help, "-h, --help", "Print this documentation" do |_help|
      puts instance_variable_get(:@parser)
      CLI.exit
    end

    after_parse :dump_runtime_info
  end
end