Skip to main content

Module parser

Module parser 

Source
Expand description

Low-level argument parsing for click-rs.

This module provides the internal option parser that handles the actual parsing of command-line arguments. It is modeled after Python Click’s parser.py and brings a similar but simplified API.

§Reference

Based on Python Click’s parser.py.

§Key Behaviors

  • -- ends option parsing; remaining args are positional
  • Short options can be grouped: -abc = -a -b -c
  • Short option with value: -nfoo or -n foo
  • Long option with value: --name=foo or --name foo

Structs§

OptionParser
The main option parser.

Enums§

OptionAction
Action to perform when an option is encountered.
ParsedValue
A parsed value from the command line.

Constants§

NARGS_OPTIONAL
Special nargs value indicating optional (? in Python Click). This is used internally to distinguish optional from 0.

Functions§

split_opt
Split an option string into its prefix and name.

Type Aliases§

ParseResult
Result type for parsing: (options, remaining args, parameter order).