From 1d15cfb6b189a21211d0981e4dc462dd15eea55c Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 26 Jan 2020 09:17:49 +0100 Subject: Make --verbose and --model options global This patch adds the attribute 'global = true' for the top-level --verbose and --model options, which ensures that they can also be set for subcommands. For example: $ nitrocli status --model pro Instead of only: $ nitrocli --model pro status --- CHANGELOG.md | 1 + src/args.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8da31f5..48f0c1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Unreleased - Added `structopt` dependency in version `0.3.7` - Replaced `argparse` with `structopt` - Removed `argparse` dependency + - Made the `--verbose` and `--model` options global - Removed vendored dependencies and moved source code into repository root - Bumped `nitrokey` dependency to `0.5.1` diff --git a/src/args.rs b/src/args.rs index 57e9743..df93814 100644 --- a/src/args.rs +++ b/src/args.rs @@ -74,10 +74,10 @@ impl<'io> Stdio for ExecCtx<'io> { #[structopt(name = "nitrocli")] struct Args { /// Increases the log level (can be supplied multiple times) - #[structopt(short, long, parse(from_occurrences))] + #[structopt(short, long, global = true, parse(from_occurrences))] verbose: u8, /// Selects the device model to connect to - #[structopt(short, long, possible_values = &DeviceModel::all_str())] + #[structopt(short, long, global = true, possible_values = &DeviceModel::all_str())] model: Option, #[structopt(subcommand)] cmd: Command, -- cgit v1.2.3