# HG changeset patch # User Mikael Berthe # Date 1494521302 -7200 # Node ID 10453a1c569820c05461acd100cf1b11942f8436 # Parent 54b6f2a4098b7926f46b46a209c15b889cabaade PlainPrinter: Display username of a status author diff -r 54b6f2a4098b -r 10453a1c5698 printer/plainprinter.go --- a/printer/plainprinter.go Thu May 11 18:05:06 2017 +0200 +++ b/printer/plainprinter.go Thu May 11 18:48:22 2017 +0200 @@ -262,11 +262,19 @@ func (p *PlainPrinter) plainPrintStatus(s *madon.Status, w io.Writer, indent string) error { indentedPrint(w, indent, true, false, "Status ID", "%d", s.ID) - indentedPrint(w, indent, false, false, "From", "%s", s.Account.Acct) + if s.Account != nil { + author := s.Account.Acct + if s.Account.DisplayName != "" { + author += " (" + s.Account.DisplayName + ")" + } + indentedPrint(w, indent, false, false, "From", "%s", author) + } indentedPrint(w, indent, false, false, "Timestamp", "%v", s.CreatedAt.Local()) if s.Reblog != nil { - indentedPrint(w, indent, false, false, "Reblogged from", "%s", s.Reblog.Account.Username) + if s.Reblog.Account != nil { + indentedPrint(w, indent, false, false, "Reblogged from", "%s", s.Reblog.Account.Username) + } return p.plainPrintStatus(s.Reblog, w, indent+p.Indent) }