7 releases

0.3.4 Mar 18, 2020
0.3.3 Mar 18, 2020
0.2.0 Mar 15, 2020
0.1.0 Mar 15, 2020

#145 in Command-line interface

50 downloads per month


114 lines


Small and lightweight enough to be put into any CLI application quickly with no fuss. Just call a macro or two and it's up and running!

If you do want a more fleshed out CLI crate, you should check out clap.

how to use

ezcli is pretty easy to use and nothing too crazy is happening. Using flag!, option!, or their named variants will allow for them to be passed as CLI args and it even creates a nifty little variable for you to use once the macro has been called.


Command line argument for a boolean state. The flag! macro only requires a variable name. Once, invoked a variable of the passed name is created and it will check the command line for matching flags.

use ezcli::flag;


if my_boolean { // "--my_boolean" exists in arguments
    // do stuff because flag is given


Command line argument for an optional parameter. The option! macro requires a variable name, like flag!, and makes it available to the scope. The value of the new variable will be a Some, unless it is not provided then it'll be None.

use ezcli::option;


match my_arg {
    Some(x) => {}, // use x
    None => {}, // handle no value


Command line argument mimicking the behaviour of the flag! macro. The only difference is that it accepts a Name, which will make short and long CLI names.

use ezcli::{named_flag, name::Name};

// --my-boolean and -b are accepted
named_flag!(my_boolean, Name::new("my-boolean", "b")); 


Like how the flag! and named_flag! macros are similar, this one is a nameable version of the option! macro.

use ezcli::{named_option, name::Name};

// --my-option and -o are accepted
named_option!(my_option, Name::new("my-option", "o"));

No runtime deps