aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/zot/main.rs
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2024-01-14 12:10:17 +0100
committerHarald Eilertsen <haraldei@anduin.net>2024-01-14 12:10:17 +0100
commit73c7feb32ec1ab9b53d0a7308ab088e9287ea5ac (patch)
tree5e3fe4dccb86f38091db7c3f8cea60a440fddaaa /src/bin/zot/main.rs
parent45962918683290be0a0ed9091d23f86f20a6d33e (diff)
downloadrust-zotapi-73c7feb32ec1ab9b53d0a7308ab088e9287ea5ac.tar.gz
rust-zotapi-73c7feb32ec1ab9b53d0a7308ab088e9287ea5ac.tar.bz2
rust-zotapi-73c7feb32ec1ab9b53d0a7308ab088e9287ea5ac.zip
bin: list channel stream summary in email like style
Diffstat (limited to 'src/bin/zot/main.rs')
-rw-r--r--src/bin/zot/main.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/bin/zot/main.rs b/src/bin/zot/main.rs
index 83ae916..383f25f 100644
--- a/src/bin/zot/main.rs
+++ b/src/bin/zot/main.rs
@@ -125,16 +125,22 @@ async fn main() -> Result<(), Box<(dyn std::error::Error + 'static)>> {
let s = Stream::from_json(&json)?;
for item in s.items {
if item.is_post() {
- if item.title.len() > 0 {
- println!("# {}", item.title);
+ let mut summary = item.title;
+
+ if summary.len() == 0 {
+ if item.summary.len() > 0 {
+ summary = item.summary;
+ } else {
+ summary = item.body;
+ }
}
- if item.summary.len() > 0 {
- println!("Summary: {}\n", item.summary);
- } else {
- println!("{}\n", item.body);
- }
- println!();
+ summary.truncate(64);
+
+ println!("{} {} - {}",
+ item.created.to_string(),
+ item.author.name,
+ summary);
}
}
//println!("{}", z.channel_stream().await?);