arg_fn 1.0.0

Argument parsing with higher order functions
Documentation
  • Coverage
  • 33.33%
    2 out of 6 items documented2 out of 6 items with examples
  • Size
  • Source code size: 4.56 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 300.18 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • Vonr/arg_fn
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Vonr

arg_fn

Argument parsing crate that allows the user to specify what to do for each argument.

Example

#[derive(PartialEq, Debug, Default)]
struct Config {
    foo: bool,
    bar: bool,
}

let cfg = arg_fn::Parser::new(Config::default(), |_cfg, _arg| {})
    .arg("-foo", |cfg| cfg.foo = true)
    .arg("-nofoo", |cfg| cfg.foo = false)
    .arg("-bar", |cfg| cfg.bar = true)
    .arg("-nobar", |cfg| cfg.bar = false)
    .parse(["-bar", "-nofoo", "-foo", "-nobar", "-foo"]);

assert_eq!(
    cfg,
    Config {
        foo: true,
        bar: false,
    }
)