aboutsummaryrefslogtreecommitdiff
path: root/src/garage/cli/util.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-01-05 16:28:46 +0100
committerAlex Auvolat <alex@adnab.me>2022-01-05 16:28:46 +0100
commitfb1e31add06ee3739fc95099aa5ffe96cf011e9c (patch)
treead3724b7dcb02e39a5311a1412d837dc42e9a155 /src/garage/cli/util.rs
parent135858d067e21e5207d275f4a56a5b721a685a07 (diff)
downloadgarage-fb1e31add06ee3739fc95099aa5ffe96cf011e9c.tar.gz
garage-fb1e31add06ee3739fc95099aa5ffe96cf011e9c.zip
Small CLI changes
Diffstat (limited to 'src/garage/cli/util.rs')
-rw-r--r--src/garage/cli/util.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/garage/cli/util.rs b/src/garage/cli/util.rs
index 365831c4..61401e4c 100644
--- a/src/garage/cli/util.rs
+++ b/src/garage/cli/util.rs
@@ -18,15 +18,15 @@ pub fn print_bucket_list(bl: Vec<Bucket>) {
.filter(|(_, _, active)| *active)
.map(|(name, _, _)| name.to_string())
.collect::<Vec<_>>();
- let local_aliases_n = match bucket
+ let local_aliases_n = match &bucket
.local_aliases()
.iter()
.filter(|(_, _, active)| *active)
- .count()
+ .collect::<Vec<_>>()[..]
{
- 0 => "".into(),
- 1 => "1 local alias".into(),
- n => format!("{} local aliases", n),
+ [] => "".into(),
+ [((k, n), _, _)] => format!("{}:{}", k, n),
+ s => format!("[{} local aliases]", s.len()),
};
table.push(format!(
"\t{}\t{}\t{}",
@@ -88,6 +88,9 @@ pub fn print_key_info(key: &Key, relevant_buckets: &HashMap<Uuid, Bucket>) {
println!("\nAuthorized buckets:");
let mut table = vec![];
for (bucket_id, perm) in p.authorized_buckets.items().iter() {
+ if !perm.is_any() {
+ continue;
+ }
let rflag = if perm.allow_read { "R" } else { " " };
let wflag = if perm.allow_write { "W" } else { " " };
let oflag = if perm.allow_owner { "O" } else { " " };