From a1b2f8da128558e51621b22516be814e21e0ba62 Mon Sep 17 00:00:00 2001 From: David Pitoniak Date: Mon, 19 Feb 2024 17:43:19 -0500 Subject: [PATCH] feat(example): add example for changing default Level --- examples/default_level.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 examples/default_level.rs diff --git a/examples/default_level.rs b/examples/default_level.rs new file mode 100644 index 0000000..0016021 --- /dev/null +++ b/examples/default_level.rs @@ -0,0 +1,24 @@ +use clap::Parser; +use clap_verbosity_flag::{InfoLevel, Verbosity}; + +#[derive(Debug, Parser)] +struct DefaultCli { + #[command(flatten)] + verbose: Verbosity, +} + +#[derive(Debug, Parser)] +struct InfoCli { + #[command(flatten)] + verbose: Verbosity, +} + +fn main() { + let error_cli = DefaultCli::parse(); + + dbg!(&error_cli.verbose); + + let info_cli = InfoCli::parse(); + + dbg!(&info_cli.verbose); +}