Small CLI changes
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Alex 2022-01-05 16:28:46 +01:00
parent 135858d067
commit fb1e31add0
No known key found for this signature in database
GPG key ID: EDABF9711E244EB1

View file

@ -18,15 +18,15 @@ pub fn print_bucket_list(bl: Vec<Bucket>) {
.filter(|(_, _, active)| *active) .filter(|(_, _, active)| *active)
.map(|(name, _, _)| name.to_string()) .map(|(name, _, _)| name.to_string())
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let local_aliases_n = match bucket let local_aliases_n = match &bucket
.local_aliases() .local_aliases()
.iter() .iter()
.filter(|(_, _, active)| *active) .filter(|(_, _, active)| *active)
.count() .collect::<Vec<_>>()[..]
{ {
0 => "".into(), [] => "".into(),
1 => "1 local alias".into(), [((k, n), _, _)] => format!("{}:{}", k, n),
n => format!("{} local aliases", n), s => format!("[{} local aliases]", s.len()),
}; };
table.push(format!( table.push(format!(
"\t{}\t{}\t{}", "\t{}\t{}\t{}",
@ -88,6 +88,9 @@ pub fn print_key_info(key: &Key, relevant_buckets: &HashMap<Uuid, Bucket>) {
println!("\nAuthorized buckets:"); println!("\nAuthorized buckets:");
let mut table = vec![]; let mut table = vec![];
for (bucket_id, perm) in p.authorized_buckets.items().iter() { for (bucket_id, perm) in p.authorized_buckets.items().iter() {
if !perm.is_any() {
continue;
}
let rflag = if perm.allow_read { "R" } else { " " }; let rflag = if perm.allow_read { "R" } else { " " };
let wflag = if perm.allow_write { "W" } else { " " }; let wflag = if perm.allow_write { "W" } else { " " };
let oflag = if perm.allow_owner { "O" } else { " " }; let oflag = if perm.allow_owner { "O" } else { " " };