From 6e94e63d8a5ad8a200946ecc398e7f87616d6d72 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Fri, 22 Jan 2021 00:12:48 +0100 Subject: sq: Make key attest-certifications' key argument optional. --- sq/src/commands/key.rs | 8 +++++--- sq/src/sq-usage.rs | 2 +- sq/src/sq_cli.rs | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'sq') diff --git a/sq/src/commands/key.rs b/sq/src/commands/key.rs index c74babec..7cf183a2 100644 --- a/sq/src/commands/key.rs +++ b/sq/src/commands/key.rs @@ -16,6 +16,9 @@ use crate::openpgp::serialize::Serialize; use crate::openpgp::types::KeyFlags; use crate::openpgp::types::SignatureType; +use crate::{ + open_or_stdin, +}; use crate::Config; use crate::create_or_stdout; use crate::SECONDS_IN_YEAR; @@ -417,9 +420,8 @@ pub fn attest_certifications(config: Config, m: &ArgMatches, _p: &dyn Policy) let reserve_area_space = 256; // For the other subpackets. let digests_per_sig = ((1usize << 16) - reserve_area_space) / digest_size; - let key = m.value_of("key").unwrap(); - let key = Cert::from_file(key) - .context(format!("Parsing key {:?}", key))?; + let input = open_or_stdin(m.value_of("key"))?; + let key = Cert::from_reader(input)?; // First, remove all attestations. let key = Cert::from_packets( diff --git a/sq/src/sq-usage.rs b/sq/src/sq-usage.rs index 57506231..c8f3e5aa 100644 --- a/sq/src/sq-usage.rs +++ b/sq/src/sq-usage.rs @@ -277,7 +277,7 @@ //! Attests third-party certifications allowing for their distribution //! //! USAGE: -//! sq key attest-certifications [FLAGS] [OPTIONS] +//! sq key attest-certifications [FLAGS] [OPTIONS] [KEY] //! //! FLAGS: //! --all Attests to all certifications diff --git a/sq/src/sq_cli.rs b/sq/src/sq_cli.rs index edce5f7d..25065a54 100644 --- a/sq/src/sq_cli.rs +++ b/sq/src/sq_cli.rs @@ -416,7 +416,6 @@ pub fn configure(app: App<'static, 'static>) -> App<'static, 'static> { .help("Attests to all certifications")) .arg(Arg::with_name("key") .value_name("KEY") - .required(true) .help("Changes attestations on KEY")) .arg(Arg::with_name("output") .short("o").long("output").value_name("FILE") -- cgit v1.2.3