Beautify table view a bit
This commit is contained in:
parent
2a9ae87b2f
commit
647b38ccb8
8
main.go
8
main.go
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue