Module: AIA::CLIParser

Defined in:
lib/aia/config/cli_parser.rb

Overview

rubocop:disable Metrics/ModuleLength

Class Method Summary collapse

Class Method Details

.parseHash

Parse CLI arguments and return a hash of overrides

Returns:

  • (Hash)

    configuration overrides from CLI



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/aia/config/cli_parser.rb', line 20

def parse
  options = {}

  begin
    parser = create_option_parser(options)
    parser.parse!
  rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
    $stderr.puts "ERROR: #{e.message}"
    $stderr.puts "       use --help for usage report"
    exit 1
  end

  # Store remaining args for prompt_id and context files
  options[:remaining_args] = ARGV.dup

  options
end