Skip to main content

Module parse

Module parse 

Source
Expand description

Zero-dependency argument parser.

Given a Command spec and the raw arguments, produces Matches: the resolved positional values and flag values. Supports:

  • --long value and --long=value
  • -s value and -svalue
  • bundled boolean shorts: -abc == -a -b -c
  • -- to stop flag parsing; everything after is positional
  • variadic trailing positionals

Parse errors are crate::error::Error with the USAGE exit code.

Structs§

Matches
The result of parsing: flag values and positional arguments by name.

Functions§

parse
Parse raw against cmd. raw should exclude the program name and the subcommand token (i.e. just the arguments to this command).