Skip to content

Commit

Permalink
Tune tabwriter
Browse files Browse the repository at this point in the history
  • Loading branch information
howardjohn committed Jul 3, 2019
1 parent 54c6f4d commit a6da27e
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions pkg/writer/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
)

const (
tabwriterMinWidth = 8
tabwriterMinWidth = 0
tabwriterWidth = 8
tabwriterPadding = 1
tabwriterPadChar = '\t'
tabwriterPadding = 2
tabwriterPadChar = ' '
)

func Write(response map[string]*model.PodResource, args *model.Args) error {
Expand Down Expand Up @@ -50,13 +50,15 @@ func Write(response map[string]*model.PodResource, args *model.Args) error {
}
}

footer := AggregateRows(allRows, model.Total)[0]
footer.Name = ""
footer.Node = ""
footer.Namespace = ""
footer.Container = ""
if _, err := w.Write([]byte(formatRow(footer, args))); err != nil {
return fmt.Errorf("write failed: %v", err)
if args.Aggregation != model.Total {
footer := AggregateRows(allRows, model.Total)[0]
footer.Name = ""
footer.Node = ""
footer.Namespace = ""
footer.Container = ""
if _, err := w.Write([]byte(formatRow(footer, args))); err != nil {
return fmt.Errorf("write failed: %v", err)
}
}

return w.Flush()
Expand Down

0 comments on commit a6da27e

Please sign in to comment.