Class: Bovem::Parser

Inherits:
Object
  • Object
show all
Includes:
Bovem::ParserMethods::General
Defined in:
lib/bovem/parser.rb

Overview

The parser for the command line.

Instance Method Summary collapse

Instance Method Details

#parse(command, args) ⇒ Hash|NilClass

Parses a command/application.

Parameters:

  • command (Command)

    The command or application to parse.

  • args (Array)

    The arguments to parse.

Returns:

  • (Hash|NilClass)

    An hash with name (of a subcommand to execute) and args keys if a valid subcommand is found, nil otherwise.



110
111
112
113
114
# File 'lib/bovem/parser.rb', line 110

def parse(command, args)
  args = args.ensure_array.dup
  forms, parser = create_parser(command)
  perform_parsing(parser, command, args, forms)
end