clap_flags

crates.io version build status downloads docs.rs docs

Collection of reusable flags for Clap.

Usage

```rust

[derive(structopt::StructOpt, paw_structopt::StructOpt)]

[structopt(author = "", raw(setting = "structopt::clap::AppSettings::ColoredHelp"))]

struct Args { #[structopt(flatten)] address: clapflags::Address, #[structopt(flatten)] logger: clapflags::Log, #[structopt(flatten)] port: clap_flags::Port, }

[async_std::main]

[paw::main]

async fn main(args: Args) -> Result<(), Box> { args.logger.start(env!("CARGOPKGNAME"))?; let mut app = tide::new(); app.at("/").get(async move |_| "Hello, world!"); app.listen((&*args.address.address, args.port.port)).await?; Ok(()) } ```

Output

```txt clap_flags 0.3.0 Collection of reusable flags for Clap

USAGE: main [FLAGS] [OPTIONS]

FLAGS: -h, --help Prints help information --log-all Enable log output from dependencies -P, --pretty Enable pretty printing -q, --quiet Suppress all log output -V, --version Prints version information -v, --verbosity Print more log output

OPTIONS: -a, --address

Network address [default: 127.0.0.1] -p, --port Insecure HTTP port [env: PORT=] [default: 80] ```

Installation

sh $ cargo add clap_flags

License

MIT OR Apache-2.0