Macro badargs::badargs[][src]

macro_rules! badargs {
    (@ inner $head : ty) => { ... };
    (@ inner $head : ty, $($tail : ty), +) => { ... };
    ($($tail : ty), +) => { ... };
}
Expand description

A shorthand for calling the badargs main function

This macro lets you specify your arguments in a flat list, and then converts them into nested tuples for you, since that’s what’s internally used.

use badargs::arg;
arg!(Force: "force", 'f' -> bool);
arg!(OutFile: "outfile", 't' -> bool);
arg!(SetUpstream: "set-upstream", 'x' -> bool);

fn main() {
    let args = badargs::badargs!(Force, OutFile, SetUpstream);
}

will be expanded into

use badargs::arg;
arg!(Force: "force", 'f' -> bool);
arg!(OutFile: "outfile", 't' -> bool);
arg!(SetUpstream: "set-upstream", 'x' -> bool);

fn main() {
    let args = badargs::badargs::<(Force, (OutFile, SetUpstream))>();
}

This only provides a minor benefit for programs with a small amount of args, but is very useful for larger arg amounts.