chore: remove unused utility functions

This commit is contained in:
Andrew Phillips (aider)
2025-05-09 16:22:18 -03:00
parent 331a971d3d
commit 01658b62b5

View File

@@ -1153,45 +1153,3 @@ fn mode_status(_cmd: &mut Command, args: Args, data_path: PathBuf, db_path: Path
Ok(()) Ok(())
} }
fn get_meta_from_env() -> HashMap<String,String> {
debug!("MAIN: Getting meta from KEEP_META_*");
let re = Regex::new(r"^KEEP_META_(.+)$").unwrap();
let mut meta_env: HashMap<String,String> = HashMap::new();
for (key, value) in env::vars() {
if let Some(meta_name_caps) = re.captures(key.as_str()) {
let name = String::from(meta_name_caps.get(1).unwrap().as_str());
debug!("MAIN: Found meta: {}={}", name.clone(), value.clone());
meta_env.insert(name, value.clone());
}
}
meta_env
}
fn format_size_human_readable(size: u64) -> String {
let options = humansize::FormatSizeOptions::from(BINARY)
.decimal_places(1);
humansize::format_size(size, options)
}
fn format_size(size: u64, human_readable: bool) -> String {
match human_readable {
true => format_size_human_readable(size),
false => size.to_string()
}
}
fn string_column(s: String, column_width: usize) -> String {
if column_width > 0 {
match s.char_indices().nth(column_width) {
None => s.to_string(),
Some((idx, _)) => s[..idx].to_string(),
}
} else {
s.to_string()
}
}
fn size_column(size: u64, human_readable: bool, column_width: usize) -> String {
string_column(format_size(size, human_readable), column_width)
}