Only show one decimal place for human mode

This commit is contained in:
Andrew Phillips
2024-02-26 18:52:46 +00:00
parent 3d2b24f4d9
commit 9623274c2b

View File

@@ -887,9 +887,17 @@ fn get_meta_from_env() -> HashMap<String,String> {
meta_env 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 { fn format_size(size: u64, human_readable: bool) -> String {
match human_readable { match human_readable {
true => humansize::format_size(size, BINARY), true => format_size_human_readable(size),
false => size.to_string() false => size.to_string()
} }
} }