Class: CliLauncher

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/framework/cli/cli_launcher.rb

Class Method Summary collapse

Class Method Details

.prepare_arguments(args, task = Facter::Cli.default_task) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/facter/framework/cli/cli_launcher.rb', line 11

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

.start(args) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/facter/framework/cli/cli_launcher.rb', line 20

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