Module: AIA::CLIParser

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

Class Method Summary collapse

Class Method Details

.parseHash

Parse CLI arguments and return a hash of overrides

Returns:

  • (Hash)

    configuration overrides from CLI



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

def parse
  options = {}

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

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

  options
end