Macro badargs::arg[][src]

macro_rules! arg {
    ($vis : vis $name : ident : $long : literal, $short : literal -> $result : ty) => { ... };
    ($vis : vis $name : ident : $long : literal -> $result : ty) => { ... };
    (@ $vis : vis $name : ident : ($long : literal, $short : expr) -> $result :
 ty) => { ... };
}
Expand description

Declare your arguments using this macro.

Possible patterns:

use badargs::arg;

arg!(LongOrShort: "long-or-short", 's' -> bool);
arg!(OnlyLong: "only-long" -> bool);
arg!(pub OtherModule: "other-module" -> bool);
use badargs::arg;

arg!(Force: "force", 'f' -> bool);

is a shorthand for

use badargs::{arg, CliArg};

struct Force;

impl CliArg for Force {
    type Content = bool;

    fn long() -> &'static str {
        "force"
    }

    fn short() -> Option<char> {
        Some('f')
    }
}