Expand description
Command line flag and option parse utilities.
§Features
no_stdandstdare 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.60.0 (7737e0b5c 2022-04-04)
§Todos
- multiple errors
-
no_std - option suggestion (do you mean? ‘–abc’)
-
windows style (like
/a) - source code generator support tools
- more easy use
§Non-Supports
- procedural macro style
- traditional macro style
- non UTF-8 arguments, multibyte or wide charactor
§Examples
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
§Supports
- flood-tide-gen - the generating flood-tide tables
- aki-gsub - the sample used flood-tide
§Alternatives
This parser is not a new special idea. It’s just comparing characters one by one. Is there anything simpler than this?
Re-exports§
pub use err::OptParseError;pub use err::OptParseErrors;pub use err::OptParseErrorKind;
Modules§
Structs§
- Lex
- Lexical analyzer
- NameVal
- Entity as the result of lex
- Opt
- Record type of opt ary table
- Tokens
- Tokens as the result of lex
Enums§
- Arg
- Option argument
Traits§
- Help
Version - check help and version of conf
- SubCommand
- setter subcmd of conf
Functions§
- parse_
simple_ gnu_ style - Parse simple gnu style.
- parse_
simple_ gnu_ style_ subcmd - Parse simple gnu style with sub command.