diff --git a/src/cmd_config.rs b/src/cmd_config.rs index 8e2894c..80fda28 100644 --- a/src/cmd_config.rs +++ b/src/cmd_config.rs @@ -9,7 +9,7 @@ use tabled::settings::Style; use crate::config::TinyEncryptConfig; use crate::util::TINY_ENC_CONFIG_FILE; -#[derive(Tabled, Ord, Eq)] +#[derive(Tabled, Eq)] struct ConfigProfile { profiles: String, keys: String, @@ -21,6 +21,12 @@ impl PartialEq for ConfigProfile { } } +impl Ord for ConfigProfile { + fn cmp(&self, other: &Self) -> Ordering { + self.profiles.cmp(&other.profiles) + } +} + impl PartialOrd for ConfigProfile { fn partial_cmp(&self, other: &Self) -> Option { self.profiles.partial_cmp(&other.profiles) diff --git a/src/cmd_info.rs b/src/cmd_info.rs index 28d840f..3e1dd90 100644 --- a/src/cmd_info.rs +++ b/src/cmd_info.rs @@ -69,7 +69,7 @@ pub fn info_single(path: &PathBuf, cmd_info: &CmdInfo) -> XResult<()> { format_human2(Duration::from_millis(now_millis - meta.created)) )); - meta.envelops.as_ref().map(|envelops| + if let Some(envelops) = meta.envelops.as_ref() { envelops.iter().enumerate().for_each(|(i, envelop)| { let kid = iff!(envelop.kid.is_empty(), "".into(), format!(", Kid: {}", envelop.kid)); let desc = envelop.desc.as_ref().map(|desc| format!(", Desc: {}", desc)).unwrap_or_else(|| "".to_string()); @@ -80,7 +80,8 @@ pub fn info_single(path: &PathBuf, cmd_info: &CmdInfo) -> XResult<()> { desc )); }) - ); + } + if let Some(fingerprint) = meta.pgp_fingerprint { infos.push(format!("{}: {}", header("PGP fingerprint"), fingerprint)); }