Crate flood_tide

Crate flood_tide 

Source
Expand description

Command line flag and option parse utilities.

§Features

  • 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.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

§Alternatives

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

Re-exports§

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

Modules§

check
Parse tables checking utilities for test.
err
Parse error module.

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§

HelpVersion
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.

Type Aliases§

OpErr
Option parse error type
OptNum
Option number type