aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-10 11:13:17 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-10 11:13:17 +0200
commitffe05c3c7d56af05f542ada65a385fecfc15c533 (patch)
treec94a44e74c0a12e99eeb4078bc5c386bbd51dfe4
parente6ce8702d452bf12929c7f5bc022ecde9ed56f21 (diff)
downloadgarage-ffe05c3c7d56af05f542ada65a385fecfc15c533.tar.gz
garage-ffe05c3c7d56af05f542ada65a385fecfc15c533.zip
Change bucket list command
-rw-r--r--src/garage/cli/util.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/garage/cli/util.rs b/src/garage/cli/util.rs
index 153e77a8..28a34daa 100644
--- a/src/garage/cli/util.rs
+++ b/src/garage/cli/util.rs
@@ -31,23 +31,18 @@ pub fn print_bucket_list(buckets: Vec<Bucket>, counters: HashMap<Uuid, HashMap<S
s => format!("[{} local aliases]", s.len()),
};
- let counters_tb = match counters.get(&bucket.id) {
- Some(c) => format!(
- "\t{}\t{}\t{}",
- bytesize::ByteSize::b(c.get(BYTES).cloned().unwrap_or_default() as u64)
- .to_string_as(true),
- c.get(OBJECTS).cloned().unwrap_or_default(),
- c.get(UNFINISHED_UPLOADS).cloned().unwrap_or_default(),
- ),
- None => "".into(),
- };
+ let empty_counters = HashMap::new();
+ let cnt = counters.get(&bucket.id).unwrap_or(&empty_counters);
table.push(format!(
- "\t{}\t{}\t{}{}",
+ "\t{}\t{}\t{}\t{}\t{}\t{}",
aliases.join(","),
local_aliases_n,
hex::encode(bucket.id),
- counters_tb
+ bytesize::ByteSize::b(cnt.get(BYTES).cloned().unwrap_or_default() as u64)
+ .to_string_as(true),
+ cnt.get(OBJECTS).cloned().unwrap_or_default(),
+ cnt.get(UNFINISHED_UPLOADS).cloned().unwrap_or_default(),
));
}
format_table(table);