1 unstable release

0.1.0 Aug 25, 2023

#11 in #verbosity

Custom license

8KB
117 lines

cli-helpers

Rust build status Coverage status

This library is intended to capture some common patterns I use for working with the Clap command-line argument parsing library for Rust.

Please note that this software is not "open source", but the source is available for use and modification by individuals, non-profit organizations, and worker-owned businesses (see the license section below for details).

License

This software is published under the Anti-Capitalist Software License (v. 1.4).


lib.rs:

Opinionated helpers for building consistent command-line interfaces with clap and simplelog.

Example

The prelude module exports a minimal subset of these two crates.

use cli_helpers::prelude::*;

#[derive(Debug, Parser)]
#[clap(name = "demo", version, author)]
struct Opts {
    #[clap(flatten)]
    verbose: Verbosity,
}

fn main() -> Result<(), cli_helpers::Error> {
    let opts: Opts = Opts::parse();
    opts.verbose.init_logging()?;
    Ok(())
}

Dependencies

~3–10MB
~96K SLoC