Compare commits

...

1 commit

Author SHA1 Message Date
0e26b65a54
checkpoint: print media attachments in timeline view 2024-06-18 10:41:14 +01:00
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" +