~gbmor/clinte

ref: cf3b6628ce4deb429fad407829b425a7377e2b5d clinte/src/conf.rs -rw-r--r-- 861 bytes
cf3b6628Ben Morrison hiding some log messages behind -v flag 1 year, 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use clap::{Arg, ArgMatches};

lazy_static! {
    pub static ref ARGS: ArgMatches<'static> = get_config();
    pub static ref DEBUG: bool = ARGS.is_present("verbose");
}

fn get_config() -> clap::ArgMatches<'static> {
    clap::App::new("clinte")
        .version(clap::crate_version!())
        .author("Ben Morrison <ben@gbmor.dev>")
        .about("Command-line community notices system")
        .arg(
            Arg::with_name("verbose")
                .short("v")
                .long("verbose")
                .help("Verbose logging"),
        )
        .subcommand(clap::SubCommand::with_name("post").about("Post a new notice"))
        .subcommand(clap::SubCommand::with_name("update").about("Update a notice you've posted"))
        .subcommand(clap::SubCommand::with_name("delete").about("Delete a notice you've posted"))
        .get_matches()
}