From 6584116e9da1a8389867584f079d868722753fca Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Mon, 10 Jun 2019 22:22:46 +0200 Subject: zotcli: Fetch group members by group id or group name. --- examples/zot/group.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'examples/zot') 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"); + } +} -- cgit v1.2.3