summaryrefslogtreecommitdiffstats
path: root/tool/src
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-07-02 14:51:45 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-07-06 12:53:04 +0200
commit60d01b22844d4f9aeafabc714e0e028cab325a92 (patch)
tree38b648c775d0e249ca77f50867f996c471360e7e /tool/src
parentd9996fabcc9d5a16f57ea2e8a6a7de58dac372d7 (diff)
sq: Improve rendering of revocations.
Diffstat (limited to 'tool/src')
-rw-r--r--tool/src/commands/inspect.rs30
1 files changed, 25 insertions, 5 deletions
diff --git a/tool/src/commands/inspect.rs b/tool/src/commands/inspect.rs
index f3e7b01d..6f5d080c 100644
--- a/tool/src/commands/inspect.rs
+++ b/tool/src/commands/inspect.rs
@@ -6,7 +6,10 @@ use clap;
extern crate sequoia_openpgp as openpgp;
use crate::openpgp::{Packet, Result};
use crate::openpgp::cert::prelude::*;
-use openpgp::packet::key::PublicParts;
+use openpgp::packet::{
+ Signature,
+ key::PublicParts,
+};
use crate::openpgp::parse::{Parse, PacketParserResult};
use crate::openpgp::policy::Policy;
use crate::openpgp::packet::key::SecretKeyMaterial;
@@ -285,11 +288,28 @@ fn inspect_revocation(output: &mut dyn io::Write,
revoked: openpgp::types::RevocationStatus)
-> Result<()> {
use crate::openpgp::types::RevocationStatus::*;
+ fn print_reasons(output: &mut dyn io::Write, indent: &str,
+ sigs: &[&Signature])
+ -> Result<()> {
+ for sig in sigs {
+ if let Some((r, _)) = sig.reason_for_revocation() {
+ writeln!(output, "{} - {}", indent, r)?;
+ } else {
+ writeln!(output, "{} - No reason specified",
+ indent)?;
+ }
+ }
+ Ok(())
+ }
match revoked {
- Revoked(_) =>
- writeln!(output, "{} Revoked", indent)?,
- CouldBe(_) =>
- writeln!(output, "{} Possibly revoked", indent)?,
+ Revoked(sigs) => {
+ writeln!(output, "{} Revoked:", indent)?;
+ print_reasons(output, indent, &sigs)?;
+ },
+ CouldBe(sigs) => {
+ writeln!(output, "{} Possibly revoked:", indent)?;
+ print_reasons(output, indent, &sigs)?;
+ },
NotAsFarAsWeKnow => (),
}