mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 20:47:01 +01:00
fix: output an array in json mode for kanidm group list
(#2016)
This commit is contained in:
parent
544689ddac
commit
17e4ad52f8
|
@ -25,16 +25,16 @@ impl GroupOpt {
|
||||||
GroupOpt::List(copt) => {
|
GroupOpt::List(copt) => {
|
||||||
let client = copt.to_client(OpType::Read).await;
|
let client = copt.to_client(OpType::Read).await;
|
||||||
match client.idm_group_list().await {
|
match client.idm_group_list().await {
|
||||||
Ok(r) => r.iter().for_each(|ent| match copt.output_mode {
|
Ok(r) => match copt.output_mode {
|
||||||
OutputMode::Json => {
|
OutputMode::Json => {
|
||||||
|
let r_attrs: Vec<_> = r.iter().map(|entry| &entry.attrs).collect();
|
||||||
println!(
|
println!(
|
||||||
"{}",
|
"{}",
|
||||||
serde_json::to_string(&ent.attrs)
|
serde_json::to_string(&r_attrs).expect("Failed to serialise json")
|
||||||
.expect("Failed to serialise json")
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
OutputMode::Text => println!("{}", ent),
|
OutputMode::Text => r.iter().for_each(|ent| println!("{}", ent)),
|
||||||
}),
|
},
|
||||||
Err(e) => error!("Error -> {:?}", e),
|
Err(e) => error!("Error -> {:?}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue