Beautify table view a bit

This commit is contained in:
Jan Philipp Timme 2018-12-31 16:47:53 +01:00
parent 2a9ae87b2f
commit 647b38ccb8
1 changed files with 4 additions and 4 deletions

View File

@ -68,10 +68,10 @@ func fetchQueueEntries() ([]parser.QEntry, error) {
}
func printQueueEntries(entries []parser.QEntry, writer io.Writer) {
tabWriter := tabwriter.NewWriter(writer, 0, 2, 1, ' ', tabwriter.TabIndent)
fmt.Fprintf(tabWriter, "%s\t%s\t%s\t%s\t%s\t%s\n", "Date", "Id", "Size", "Sender", "#", "First Recipient")
tabWriter := tabwriter.NewWriter(writer, 2, 2, 1, ' ', tabwriter.TabIndent)
fmt.Fprintf(tabWriter, "| %s\t| %s\t| %s\t| %s\t| %s\t| %s\t| %s\t| \n", "Date", "Id", "Size", "Sender", "#", "First Recipient", "Reason")
for _, entry := range entries {
_, writeError := fmt.Fprintf(tabWriter, "%s\t%s\t%d\t%s\t{%d}\t%s\n", entry.Date, entry.Id, entry.Size, entry.Sender, len(entry.Recipients), entry.Recipients[0])
_, writeError := fmt.Fprintf(tabWriter, "| %s\t| %s\t| %d\t| %s\t| {%d}\t| %s\t| %s\t \n", entry.Date, entry.Id, entry.Size, entry.Sender, len(entry.Recipients), entry.Recipients[0], entry.Reason)
if writeError != nil {
// A writeError is expected once the reader was closed
// This happens when the pager application got terminated
@ -83,7 +83,7 @@ func printQueueEntries(entries []parser.QEntry, writer io.Writer) {
}
func launchPager(reader *io.PipeReader, pagerDone chan<- bool) {
cmd := exec.Command("less")
cmd := exec.Command("less", "--chop-long-lines")
cmd.Stdin = reader
cmd.Stdout = os.Stdout
if err := cmd.Start(); err != nil {