[][src]Macro ezcli::option

macro_rules! option {
    ($name:tt, $args:ident) => { ... };
    ($name:tt) => { ... };
}

Optional command line argument with associated value.

When provided via command line it will return Some wrapping the value passed along with it. None will be returned when the option is not provided or does not follow syntax.

use ezcli::option;

// accepts "--my_option"
// "my_option" will be an Option<String>
option!(my_option);

In some case of not wanting to use the program's environment arguments using a slice is also possible.

use ezcli::option;

let args = ["--my_option", "value"];

// accepts "--my_option"
// "my_option" will be an Option<String>
option!(my_option, args);