aboutsummaryrefslogtreecommitdiffstats
path: root/examples/zot
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2019-06-10 22:22:46 +0200
committerHarald Eilertsen <haraldei@anduin.net>2019-06-10 22:22:46 +0200
commit6584116e9da1a8389867584f079d868722753fca (patch)
tree3ba548112d02ebd7c1655ce915ed69b812aaabe4 /examples/zot
parent8158bee4cbb5cc599c38788f0aa12a489e5261c1 (diff)
downloadrust-zotapi-6584116e9da1a8389867584f079d868722753fca.tar.gz
rust-zotapi-6584116e9da1a8389867584f079d868722753fca.tar.bz2
rust-zotapi-6584116e9da1a8389867584f079d868722753fca.zip
zotcli: Fetch group members by group id or group name.
Diffstat (limited to 'examples/zot')
-rw-r--r--examples/zot/group.rs19
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");
+ }
+}