Crates.io | clap_flags |
lib.rs | clap_flags |
version | 0.5.0 |
source | src |
created_at | 2018-08-06 15:08:29.68048 |
updated_at | 2020-03-02 11:21:04.813128 |
description | Collection of reusable flags for Clap |
homepage | |
repository | https://github.com/yoshuawuyts/clap_flags |
max_upload_size | |
id | 77766 |
size | 71,041 |
Collection of reusable flags for Clap.
#[derive(structopt::StructOpt, paw_structopt::StructOpt)]
#[structopt(author = "", raw(setting = "structopt::clap::AppSettings::ColoredHelp"))]
struct Args {
#[structopt(flatten)]
address: clap_flags::Address,
#[structopt(flatten)]
logger: clap_flags::Log,
#[structopt(flatten)]
port: clap_flags::Port,
}
#[async_std::main]
#[paw::main]
async fn main(args: Args) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
args.logger.start(env!("CARGO_PKG_NAME"))?;
let mut app = tide::new();
app.at("/").get(async move |_| "Hello, world!");
app.listen((&*args.address.address, args.port.port)).await?;
Ok(())
}
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 <address> Network address [default: 127.0.0.1]
-p, --port <port> Insecure HTTP port [env: PORT=] [default: 80]
$ cargo add clap_flags
MIT OR Apache-2.0