From 1c8a2a0924ceffc8b71f35184c990a5d9a9380d8 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Sun, 30 Dec 2018 13:23:30 +0100 Subject: [PATCH] Improve detailed QEntry String representation --- parser/parser.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/parser/parser.go b/parser/parser.go index 44f0666..901813b 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -36,7 +36,11 @@ func (m QEntry) String() string { } func (m QEntry) DetailedString() string { - return fmt.Sprintf("Id: %s\nDate: %s\nStatus: %s\nReason: %s\nSize: %d\nSender: %s\nRecipients: %s", m.id, m.date.Format(sortableDateFormat), m.status, m.reason, m.size, m.sender, strings.Join(m.recipients, ", ")) + var reasonStr string + if m.reason == "" { + reasonStr = "-/-" + } + return fmt.Sprintf("Id: %s\nDate: %s\nStatus: %s\nReason: %s\nSize: %d\nSender: %s\nRecipients: %s", m.id, m.date.Format(sortableDateFormat), m.status, reasonStr, m.size, m.sender, strings.Join(m.recipients, ", ")) } func ParseMailQ(dataSource io.Reader) ([]QEntry, error) {