summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2022-06-20 22:54:31 -0400
committerGalen Guyer <galen@galenguyer.com>2022-06-20 22:56:14 -0400
commitb3e6f24f97c4d262002a57ff7b5aea040a4c84d6 (patch)
treedead03e885262d40026df2e82530af44f9cb3f7a
parent0ba4f8fc438c93666b8ee3f9caec615c97a385b0 (diff)
slightly nicer expiry formatting
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--src/lib/ops.rs18
3 files changed, 18 insertions, 4 deletions
diff --git a/Cargo.lock b/Cargo.lock
index c64492e..1d3ea9d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -117,7 +117,7 @@ dependencies = [
[[package]]
name = "hancock"
-version = "1.1.0"
+version = "1.2.0"
dependencies = [
"clap",
"openssl",
diff --git a/Cargo.toml b/Cargo.toml
index 8679984..56561fd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "hancock"
-version = "1.1.0"
+version = "1.2.0"
edition = "2021"
diff --git a/src/lib/ops.rs b/src/lib/ops.rs
index efb739a..a0eac3d 100644
--- a/src/lib/ops.rs
+++ b/src/lib/ops.rs
@@ -255,10 +255,24 @@ fn cert_info(crt: openssl::x509::X509) -> String {
let cn = get_cn(&crt);
let ex = match now.compare(crt.not_after()).unwrap() {
Ordering::Greater => {
- format!("{} days ago", now.diff(crt.not_after()).unwrap().days)
+ match now.diff(crt.not_after()).unwrap().days {
+ 1 => {
+ String::from("1 day ago")
+ }
+ d @ _ => {
+ format!("{} days ago", d)
+ }
+ }
}
Ordering::Less => {
- format!("in {} days", now.diff(crt.not_after()).unwrap().days)
+ match now.diff(crt.not_after()).unwrap().days {
+ 1 => {
+ String::from("in 1 day")
+ }
+ d @ _ => {
+ format!("in {} days", d)
+ }
+ }
}
Ordering::Equal => String::from("right now"),
};