pub fn parse_options(
arguments: &[OsString],
table: &[OptionSpec],
mode: ParseMode,
wrapper_flags: &[&[u8]],
) -> Result<ParsedOptions, OptionError>Expand description
What:
Tokenize one region in a single forward pass (parse_options_step,
parse-options.c:995-1169).
Result<A, B> is “either success A or failure B”.
Why:
One faithful scan replaces per-command guesses about option arity.
Gotcha:
Indexes in the result are relative to arguments,
the region after the subcommand.
In TS you’d write (pseudocode):
function parseOptions({ args, table, mode, wrapperFlags }): ParsedOptions; // throws OptionError