Change bucket list command
This commit is contained in:
parent
e6ce8702d4
commit
ffe05c3c7d
1 changed files with 7 additions and 12 deletions
|
@ -31,23 +31,18 @@ pub fn print_bucket_list(buckets: Vec<Bucket>, counters: HashMap<Uuid, HashMap<S
|
||||||
s => format!("[{} local aliases]", s.len()),
|
s => format!("[{} local aliases]", s.len()),
|
||||||
};
|
};
|
||||||
|
|
||||||
let counters_tb = match counters.get(&bucket.id) {
|
let empty_counters = HashMap::new();
|
||||||
Some(c) => format!(
|
let cnt = counters.get(&bucket.id).unwrap_or(&empty_counters);
|
||||||
"\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(),
|
|
||||||
};
|
|
||||||
|
|
||||||
table.push(format!(
|
table.push(format!(
|
||||||
"\t{}\t{}\t{}{}",
|
"\t{}\t{}\t{}\t{}\t{}\t{}",
|
||||||
aliases.join(","),
|
aliases.join(","),
|
||||||
local_aliases_n,
|
local_aliases_n,
|
||||||
hex::encode(bucket.id),
|
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);
|
format_table(table);
|
||||||
|
|
Loading…
Reference in a new issue