Expand description

Command line flag and option parse utilities.


  • no_std and std are supported.
  • flags, options, subcommand and free arguments
  • short flags and options (like -a)
  • long flags and options (like --long)
  • combined short flags (like -abc ::= -a -b -c)
  • single long options (like -long)
  • abbreviate long options (like --abbr ::= --abbreviate)
  • single error or multiple errors
  • only UTF-8 arguments
  • it can be used optimally by a compile switch with many features.
  • minimum support rustc 1.56.1 (59eed8a2a 2021-11-01)


  • multiple errors
  • no_std
  • option suggestion (do you mean? ‘–abc’)
  • windows style (like /a)
  • source code generator support tools
  • more easy use


  • procedural macro style
  • traditional macro style
  • non UTF-8 arguments, multibyte or wide charactor


in examples directory.

  • manual coding style: bsd-sed.rs, gnu-cat.rs
  • single long options: ffmpeg.rs
  • source code generating by xtask and parse_simple_gnu_style(): curl.rs



This parser is not a new special idea. It’s just comparing characters one by one. Is there anything simpler than this?

  • clap - is the most popular and complete one
  • structopt - clap parser that uses procedural macros
  • gumdrop - a simple parser that uses procedural macros
  • argh - procedural macros
  • rustop - traditional macro
  • pico-args - a simple use
  • getopts - a simple use
  • docopt - a simple use


pub use err::OptParseError;
pub use err::OptParseErrors;
pub use err::OptParseErrorKind;


Parse tables checking utilities for test.

Parse error module.


Lexical analyzer

Entity as the result of lex

Record type of opt ary table

Tokens as the result of lex


Option argument


check help and version of conf

setter subcmd of conf


Parse simple gnu style.

Parse simple gnu style with sub command.

Type Definitions

Option parse error type

Option number type