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.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/bin/zot/main.rs b/src/bin/zot/main.rs
index 5828f44..09fdd61 100644
--- a/src/bin/zot/main.rs
+++ b/src/bin/zot/main.rs
@@ -22,7 +22,8 @@ use std::str::FromStr;
mod zot;
-fn main() {
+#[tokio::main]
+async fn main() {
dotenv().ok();
let site = env::var("HZ_SITE").expect("SITE variable expected");
let user = env::var("HZ_USER").expect("USER variable expected");
@@ -79,24 +80,25 @@ fn main() {
match matches.subcommand() {
("channel", Some(m)) => {
let raw = m.is_present("raw");
- zot::channel_stream::fetch(&client, raw);
+ zot::channel_stream::fetch(&client, raw).await;
}
("network", Some(m)) => {
let raw = m.is_present("raw");
- zot::network_stream::fetch(&client, raw);
+ zot::network_stream::fetch(&client, raw).await;
}
("abconfig", _) => {
- zot::abconfig::fetch(&client);
+ zot::abconfig::fetch(&client).await;
}
("abook", Some(m)) => {
let raw = m.is_present("raw");
- zot::abook::fetch(&client, raw);
+ zot::abook::fetch(&client, raw).await;
}
("group", Some(m)) => {
if let Some(id) = m.value_of("ID") {
let res = zotapi::group_members()
.by_group_id(u64::from_str(id).unwrap())
.fetch(&client)
+ .await
.unwrap();
if m.is_present("raw") {
@@ -108,6 +110,7 @@ fn main() {
let res = zotapi::group_members()
.by_group_name(gname)
.fetch(&client)
+ .await
.unwrap();
if m.is_present("raw") {
@@ -116,7 +119,7 @@ fn main() {
zot::group::list_members(&res);
}
} else {
- let res = zotapi::group().fetch(&client).unwrap();
+ let res = zotapi::group().fetch(&client).await.unwrap();
if m.is_present("raw") {
println!("{}", res);
@@ -135,10 +138,10 @@ fn main() {
zot::xchan::Type::Addr
};
- zot::xchan::fetch(&client, raw, t, m.value_of("ID").unwrap());
+ zot::xchan::fetch(&client, raw, t, m.value_of("ID").unwrap()).await;
}
("post", Some(m)) => {
- zot::item::post(&client, m);
+ zot::item::post(&client, m).await;
}
_ => {
println!("{}", matches.usage());