aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bin/zot/main.rs19
-rw-r--r--src/zotapi.rs4
2 files changed, 21 insertions, 2 deletions
diff --git a/src/bin/zot/main.rs b/src/bin/zot/main.rs
index 50dfb97..a919e35 100644
--- a/src/bin/zot/main.rs
+++ b/src/bin/zot/main.rs
@@ -58,8 +58,11 @@ async fn main() -> Result<(), Box<(dyn std::error::Error + 'static)>> {
(@subcommand network =>
(about: "Fetch the network stream")
)
- (@subcommand abook =>
- (about: "Fetch address book/contact info")
+ (@subcommand contact =>
+ (about: "Work with address book/contact info")
+ (@subcommand list =>
+ (about: "List the current channels contacts.")
+ )
)
(@subcommand abconfig =>
(about: "Fetch abconfig")
@@ -154,6 +157,18 @@ async fn main() -> Result<(), Box<(dyn std::error::Error + 'static)>> {
}
}
}
+ ("abook", Some(m)) => {
+ match m.subcommand() {
+ ("list", Some(_)) => {
+ let r = z.abook_list().await?;
+ println!("{}", r);
+ }
+ _ => {
+ println!("Not a known subcommand for `abook`, or it's not implemented yet.");
+ println!("{}", m.usage());
+ }
+ }
+ }
/*
("network", Some(m)) => {
let raw = m.is_present("raw");
diff --git a/src/zotapi.rs b/src/zotapi.rs
index 0a5c317..a15b51a 100644
--- a/src/zotapi.rs
+++ b/src/zotapi.rs
@@ -93,6 +93,10 @@ impl ZotApi {
Ok(self.get("channel/export/basic").send().await?.text().await?)
}
+ pub async fn abook_list(&self) -> Result<String, Error> {
+ Ok(self.get("abook").send().await?.text().await?)
+ }
+
/// Return a RequestBuilder object that's set up with the correct