aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/zot/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/zot/main.rs')
-rw-r--r--src/bin/zot/main.rs27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/bin/zot/main.rs b/src/bin/zot/main.rs
index 09fdd61..f2caac4 100644
--- a/src/bin/zot/main.rs
+++ b/src/bin/zot/main.rs
@@ -90,8 +90,13 @@ async fn main() {
zot::abconfig::fetch(&client).await;
}
("abook", Some(m)) => {
- let raw = m.is_present("raw");
- zot::abook::fetch(&client, raw).await;
+ let r = zotapi::Abook::z();
+
+ if m.is_present("raw") {
+ println!("{}", r.fetch_raw(&client).await.unwrap());
+ } else {
+ println!("{:?}", r.fetch(&client).await);
+ }
}
("group", Some(m)) => {
if let Some(id) = m.value_of("ID") {
@@ -129,16 +134,22 @@ async fn main() {
}
}
("xchan", Some(m)) => {
- let raw = m.is_present("raw");
- let t = if m.is_present("guid") {
- zot::xchan::Type::GUID
+ let mut r = zotapi::XChan::z();
+ let id = m.value_of("ID").expect("No xchan provided.");
+
+ if m.is_present("guid") {
+ r.by_guid(id)
} else if m.is_present("hash") {
- zot::xchan::Type::Hash
+ r.by_hash(id)
} else {
- zot::xchan::Type::Addr
+ r.by_address(id)
};
- zot::xchan::fetch(&client, raw, t, m.value_of("ID").unwrap()).await;
+ if m.is_present("raw") {
+ println!("{}", r.fetch_raw(&client).await.unwrap());
+ } else {
+ println!("{:?}", r.fetch(&client).await);
+ }
}
("post", Some(m)) => {
zot::item::post(&client, m).await;