summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2021-01-22 00:12:48 +0100
committerJustus Winter <justus@sequoia-pgp.org>2021-01-22 00:12:48 +0100
commit6e94e63d8a5ad8a200946ecc398e7f87616d6d72 (patch)
treef5d8f9e8ce7129cadf5155fbdb3af870f7590408
parent782291af1426e35ae36a3a52ea5c551bd2348c67 (diff)
sq: Make key attest-certifications' key argument optional.
-rw-r--r--sq/src/commands/key.rs8
-rw-r--r--sq/src/sq-usage.rs2
-rw-r--r--sq/src/sq_cli.rs1
3 files changed, 6 insertions, 5 deletions
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] <KEY>
+//! 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")