From 22007fb6b71a23f126cac66f1d55d171f630bb5c Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 15 Apr 2024 01:18:25 +0000 Subject: [PATCH] fix numbat aliases like mib -> MiB --- README | 2 +- src/engines/answer/numbat.rs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README b/README index bc3586c..22a2f0b 100644 --- a/README +++ b/README @@ -17,4 +17,4 @@ the config.toml file is created in your current working directory on the first run of metasearch2. alternatively, you can copy the default-config.toml in the repo and rename it to config.toml. -the default port is port 28019. +the default port is 28019. diff --git a/src/engines/answer/numbat.rs b/src/engines/answer/numbat.rs index 4af9f36..661a29c 100644 --- a/src/engines/answer/numbat.rs +++ b/src/engines/answer/numbat.rs @@ -93,7 +93,8 @@ fn interpret(query: &str) -> Option<(Statement, Markup)> { CodeSource::Text, ) { Ok(r) => r, - Err(_) => { + Err(err) => { + eprintln!("numbat error: {}", err); return None; } }; @@ -185,10 +186,15 @@ pub static NUMBAT_CTX: Lazy = Lazy::new(|| { // (the lowercase alias code won't work for these because they have prefixes) for (alias, canonical) in &[ ("kb", "kB"), + ("kib", "KiB"), ("mb", "MB"), + ("mib", "MiB"), ("gb", "GB"), + ("gib", "GiB"), ("tb", "TB"), + ("tib", "TiB"), ("pb", "PB"), + ("pib", "PiB"), ] { let _ = ctx.interpret(&format!("let {alias} = {canonical}"), CodeSource::Internal); }