The processing starts with an array of args. Each command processes and removes the options it understands, and passes the remaining args to the next subcommand. The final command calls the action handler.
Starting with top-level command (program):
- process options for this command (includes calling or chaining provided argParsers1)
- recognised options from args
- options based on environment variables
- set implied option values (for this command)
- remove recognised options from args
- await thenable option values if parsing with
parseAsync()
- if the first arg is a subcommand
- call or chain
preSubcommand
hooks1 - pass remaining arguments to subcommand, and process same way
- call or chain
Once reach final (leaf) command:
- check for missing mandatory options
- check for conflicting options
- check for unknown options
- process remaining args as command-arguments (includes calling or chaining provided argParsers1)
- await thenable argument values if parsing with
parseAsync()
- if an action handler is provided