Server IP : 104.21.14.103 / Your IP : 3.14.142.131 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/cli/ |
Upload File : |
#!/usr/bin/env ruby # frozen_string_literal: true require_relative '../../../facter/framework/logging/logger' Facter::Log.output(STDERR) require_relative '../../../facter' require_relative '../../../facter/framework/cli/cli' class CliLauncher class << self def prepare_arguments(args, task = Facter::Cli.default_task) args.unshift(task) unless check_if_arguments_is_known(Facter::Cli.all_tasks, args) || check_if_arguments_is_known(Facter::Cli.instance_variable_get(:@map), args) || !task reorder_program_arguments(args) end def start(args) # stop parsing arguments if we don't recognize them Thor.check_unknown_options! Facter::Cli.start(args, debug: true) rescue Thor::UnknownArgumentError => e Facter::OptionsValidator.write_error_and_exit("unrecognised option '#{e.unknown.first}'") end private def check_if_arguments_is_known(known_arguments, program_arguments) program_arguments.each do |argument| return true if known_arguments.key?(argument) end false end def reorder_program_arguments(program_arguments) priority_arguments = Facter::Cli.instance_variable_get(:@map) priority_args = [] normal_args = [] program_arguments.each do |argument| if priority_arguments.include?(argument) priority_args << argument else normal_args << argument end end priority_args.concat(normal_args) end end end