module Fontist::CLI::ClassOptions
Public Class Methods
included(base)
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/fontist/cli/class_options.rb, line 5 def self.included(base) base.class_option :preferred_family, type: :boolean, desc: "Use Preferred Family when available" base.class_option :quiet, aliases: :q, type: :boolean, desc: "Hide all messages" base.class_option :verbose, aliases: :v, type: :boolean, desc: "Print debug messages" base.class_option :no_cache, aliases: :c, type: :boolean, desc: "Avoid using cache during download" base.class_option :interactive, aliases: :i, type: :boolean, default: true, desc: "Interactive mode" base.class_option :formulas_path, type: :string, desc: "Path to formulas" end
Public Instance Methods
handle_class_options(options)
click to toggle source
rubocop:enable Metrics/MethodLength
# File lib/fontist/cli/class_options.rb, line 37 def handle_class_options(options) Fontist.preferred_family = options[:preferred_family] Fontist.log_level = log_level(options) Fontist.use_cache = !options[:no_cache] Fontist.interactive = options[:interactive] if options[:formulas_path] Fontist.formulas_path = Pathname.new(options[:formulas_path]) end end
log_level(options)
click to toggle source
# File lib/fontist/cli/class_options.rb, line 48 def log_level(options) return :debug if options[:verbose] return :fatal if options[:quiet] :info end