Sha256: 0d36b0e8e3b2ad74cf783d8f58b49d63c119c6637cd01a950df309793f268540
Contents?: true
Size: 1.49 KB
Versions: 3
Compression:
Stored size: 1.49 KB
Contents
# frozen_string_literal: true module Facter module HelperOptions def augment_with_helper_options!(user_query) @options[:user_query] = true if user_query.any? no_ruby # convert array or string to array @options[:external_dir] = [*@options[:external_dir]] unless @options[:external_dir].nil? @options[:log_level] = log_level || @options[:log_level].to_sym @options[:debug] = true if @options[:log_level] == :debug validate_log_level Log.level = @options[:log_level] Facter.trace(@options[:trace]) end private def no_ruby return if @options[:ruby] @options[:custom_facts] = false @options[:blocked_facts] = ['ruby'].concat(@options[:blocked_facts] || []) end def log_level if @options[:debug] || @options[:log_level] == :trace :debug elsif @options[:verbose] :info end end def validate_log_level if @options[:log_level].empty? OptionsValidator.write_error_and_exit('the required argument for option'\ " '--log-level' is missing") end unless OptionsValidator::LOG_LEVEL.include?( @options[:log_level].to_sym ) OptionsValidator.write_error_and_exit("invalid log level #{@options[:log_level]} : expected none, trace,"\ ' debug, info, warn, error, or fatal.') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facter-4.0.15 | lib/framework/core/options/helper_options.rb |
facter-4.0.14 | lib/framework/core/options/helper_options.rb |
facter-4.0.13 | lib/framework/core/options/helper_options.rb |