1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Collection of reusable flags for Clap.
//!
//! ## Examples
//! ```no_run
//!
//! #[derive(structopt::StructOpt, paw_structopt::StructOpt)]
//! #[structopt(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(())
//! }
//! ```
//!
//! ## 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 <address>    Network address [default: 127.0.0.1]
//!     -p, --port <port>          Insecure HTTP port [env: PORT=]  [default: 80]
//! ```

#![forbid(unsafe_code, future_incompatible, rust_2018_idioms)]
#![deny(missing_debug_implementations, nonstandard_style)]
#![warn(missing_docs, missing_doc_code_examples, unreachable_pub)]
#![cfg_attr(test, deny(warnings))]

mod address;
mod log;
mod port;

pub use crate::log::*;
pub use address::*;
pub use port::*;