#macros #mod #private

xflags-macros

Private implementation details of xflags

8 releases

0.2.2 Jun 10, 2021
0.2.1 Mar 6, 2021
0.1.4 Mar 5, 2021
Download history 685/week @ 2021-02-26 1938/week @ 2021-03-05 2771/week @ 2021-03-12 2584/week @ 2021-03-19 2537/week @ 2021-03-26 3116/week @ 2021-04-02 3018/week @ 2021-04-09 3032/week @ 2021-04-16 2988/week @ 2021-04-23 3251/week @ 2021-04-30 3195/week @ 2021-05-07 2970/week @ 2021-05-14 2999/week @ 2021-05-21 3016/week @ 2021-05-28 3085/week @ 2021-06-04 2455/week @ 2021-06-11

12,638 downloads per month
Used in 3 crates (via xflags)

MIT/Apache

30KB
924 lines

API reference

xflags

Moderately simple command line arguments parsing:

mod flags {
    use std::path::PathBuf;

    xflags::xflags! {
        src "./examples/basic.rs"

        cmd my-command
            required path: PathBuf
        {
            optional -v, --verbose
        }
    }

    // generated start
    // The following code is generated by `xflags` macro.
    // Run `env UPDATE_XFLAGS=1 cargo build` to regenerate.
    #[derive(Debug)]
    pub struct MyCommand {
        pub path: PathBuf,

        pub verbose: bool,
    }

    impl MyCommand {
        pub const HELP: &'static str = Self::HELP_;

        pub fn from_env() -> xflags::Result<Self> {
            Self::from_env_()
        }

        pub fn from_vec(args: Vec<std::ffi::OsString>) -> xflags::Result<Self> {
            Self::from_vec_(args)
        }
    }
    // generated end
}

fn main() {
    let flags = flags::MyCommand::from_env();
    println!("{:#?}", flags);
}

Dependencies

~79KB