diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2022-07-04 23:31:19 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2022-07-05 13:57:05 +0200 |
commit | 531386899efe93e18e6e8b62e82c07b62579cc76 (patch) | |
tree | cc15e34456cda2fca37fbac6201630f4c8df839b /sq | |
parent | 78f86a6a61f26831ae35d06e568659cb5c9c7cf8 (diff) |
sq: Adapt sq inspect to clap3's derive API.
Diffstat (limited to 'sq')
-rw-r--r-- | sq/src/commands/inspect.rs | 8 | ||||
-rw-r--r-- | sq/src/sq.rs | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/sq/src/commands/inspect.rs b/sq/src/commands/inspect.rs index 7873c91f..50463324 100644 --- a/sq/src/commands/inspect.rs +++ b/sq/src/commands/inspect.rs @@ -17,11 +17,13 @@ use super::dump::Convert; use crate::SECONDS_IN_YEAR; use crate::SECONDS_IN_DAY; -pub fn inspect(m: &clap::ArgMatches, policy: &dyn Policy, output: &mut dyn io::Write) +use crate::sq_cli::InspectCommand; + +pub fn inspect(c: InspectCommand, policy: &dyn Policy, output: &mut dyn io::Write) -> Result<()> { - let print_certifications = m.is_present("certifications"); + let print_certifications = c.certifications; - let input = m.value_of("input"); + let input = c.input.as_deref(); let input_name = input.unwrap_or("-"); write!(output, "{}: ", input_name)?; diff --git a/sq/src/sq.rs b/sq/src/sq.rs index dd7853d5..e0fcfd32 100644 --- a/sq/src/sq.rs +++ b/sq/src/sq.rs @@ -634,10 +634,12 @@ fn main() -> Result<()> { commands::autocrypt::dispatch(config, &command)?; }, Some(("inspect", m)) => { + use clap::FromArgMatches; + let command = sq_cli::InspectCommand::from_arg_matches(m)?; // sq inspect does not have --output, but commands::inspect does. // Work around this mismatch by always creating a stdout output. let mut output = config.create_or_stdout_unsafe(None)?; - commands::inspect(m, policy, &mut output)?; + commands::inspect(command, policy, &mut output)?; }, Some(("keyring", m)) => commands::keyring::dispatch(config, m)?, |