From 04e9220b43b039651fe5207500c58bbc3e07c5a7 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Mon, 7 Sep 2026 11:39:40 +0900 Subject: [PATCH] podcast: keep each episode on one line in 'list'. --- podcast.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/podcast.go b/podcast.go index 0b60dd0..0ed034b 100644 --- a/podcast.go +++ b/podcast.go @@ -553,6 +553,13 @@ func firstPodcastAudioURL(evt nostr.Event) string { return "" } +// singleLine joins the lines of s with spaces, dropping the blank ones. +func singleLine(s string) string { + return strings.Join(strings.FieldsFunc(s, func(r rune) bool { + return r == '\n' || r == '\r' + }), " ") +} + func podcastTagValue(evt nostr.Event, name string) string { if tag := evt.Tags.Find(name); len(tag) >= 2 { return tag[1] @@ -664,7 +671,9 @@ func printPodcastEpisodeList(ctx context.Context, p podcastInfo, limit int) erro } id := ep.ID.Hex()[:8] date := ep.CreatedAt.Time().Format("2006-01-02") - desc := clampWithEllipsis(ep.Content, 100) + // episode descriptions are several paragraphs long, so fold them into + // the single line each episode gets here + desc := clampWithEllipsis(singleLine(ep.Content), 100) stdout(fmt.Sprintf("%s %s %s %s", color.CyanString(id), date, title, desc)) }