diff options
Diffstat (limited to 'examples/zot')
-rw-r--r-- | examples/zot/group.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/zot/group.rs b/examples/zot/group.rs index 6bb3839..e02fb13 100644 --- a/examples/zot/group.rs +++ b/examples/zot/group.rs @@ -50,3 +50,22 @@ pub fn list(data: &str) { eprintln!("Invalid data"); } } + + +pub fn list_members(data: &str) { + if let Ok(Value::Array(members)) = from_str(&data) { + + println!("Id | Name | Address"); + println!("----+-------------------------------+------------------------"); + + for member in members { + println!("{:>3} | {:29} | {}", + member["id"].as_u64().unwrap(), + member["xchan_name"].as_str().unwrap(), + member["xchan_addr"].as_str().unwrap()); + } + } + else { + eprintln!("Invalid data"); + } +} |