From c845b0a07a0c39213c7f83e8f20b340958a430e0 Mon Sep 17 00:00:00 2001 From: Dan Anglin Date: Tue, 18 Jun 2024 10:41:14 +0100 Subject: [PATCH] checkpoint: print media attachments in timeline view --- internal/printer/printer.go | 4 +++- internal/printer/status.go | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/printer/printer.go b/internal/printer/printer.go index 72cc97a..241d447 100644 --- a/internal/printer/printer.go +++ b/internal/printer/printer.go @@ -39,6 +39,7 @@ type Printer struct { failureSymbol string dateFormat string dateTimeFormat string + imageIcon string } func NewPrinter( @@ -62,6 +63,7 @@ func NewPrinter( } return &Printer{ + theme: theme, noColor: noColor, maxTerminalWidth: maxTerminalWidth, pager: pager, @@ -72,7 +74,7 @@ func NewPrinter( failureSymbol: "\u2717", dateFormat: "02 Jan 2006", dateTimeFormat: "02 Jan 2006, 15:04 (MST)", - theme: theme, + imageIcon: "\uf03e", } } diff --git a/internal/printer/status.go b/internal/printer/status.go index 7dbf9c3..b89675d 100644 --- a/internal/printer/status.go +++ b/internal/printer/status.go @@ -79,6 +79,16 @@ func (p Printer) PrintStatusList(list model.StatusList) { builder.WriteString(p.pollOptions(*status.Poll)) } + for _, media := range status.MediaAttachments { + builder.WriteString("\n\n" + p.imageIcon + " Media (" + media.ID + ")" + "\n ") + + if media.Description == "" { + builder.WriteString("This media has no description.") + } else { + builder.WriteString(utilities.WrapLines(media.Description, "\n ", p.maxTerminalWidth-3)) + } + } + builder.WriteString( "\n\n" + p.fieldFormat("Status ID:") + " " + statusID + "\t" +