diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2024-01-14 12:10:17 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2024-01-14 12:10:17 +0100 |
commit | 73c7feb32ec1ab9b53d0a7308ab088e9287ea5ac (patch) | |
tree | 5e3fe4dccb86f38091db7c3f8cea60a440fddaaa | |
parent | 45962918683290be0a0ed9091d23f86f20a6d33e (diff) | |
download | rust-zotapi-73c7feb32ec1ab9b53d0a7308ab088e9287ea5ac.tar.gz rust-zotapi-73c7feb32ec1ab9b53d0a7308ab088e9287ea5ac.tar.bz2 rust-zotapi-73c7feb32ec1ab9b53d0a7308ab088e9287ea5ac.zip |
bin: list channel stream summary in email like style
-rw-r--r-- | src/bin/zot/main.rs | 22 | ||||
-rw-r--r-- | src/stream/actor.rs | 2 |
2 files changed, 15 insertions, 9 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?); diff --git a/src/stream/actor.rs b/src/stream/actor.rs index 4e2bbe4..3ee371d 100644 --- a/src/stream/actor.rs +++ b/src/stream/actor.rs @@ -12,7 +12,7 @@ use url::Url; #[derive(Debug, Deserialize, PartialEq)] pub struct Actor { - name: String, + pub name: String, address: Option<String>, url: Option<Url>, id: String, |