checkpoint: print media attachments in timeline view

This commit is contained in:
Dan Anglin 2024-06-18 10:41:14 +01:00
parent 2a386fcda5
commit c845b0a07a
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
2 changed files with 13 additions and 1 deletions

View file

@ -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",
}
}

View file

@ -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" +