Method: Executable::Parser#parse

Defined in:
lib/executable/parser.rb

#parse(argv = ARGV) ⇒ Object

Parse command-line.

Parameters:

  • argv (Array, String) (defaults to: ARGV)

    command-line arguments



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/executable/parser.rb', line 21

def parse(argv=ARGV)
  # duplicate to make sure ARGV stay intact.
  argv = argv.dup
  argv = parse_shellwords(argv)

  cmd, argv = parse_subcommand(argv)
  cli  = cmd.new
  args = parse_arguments(cli, argv)

  return cli, args
end