Skip to content

Commit

Permalink
Fix text spacing hwn color coding
Browse files Browse the repository at this point in the history
  • Loading branch information
zix99 committed Oct 12, 2019
1 parent e52f9d8 commit 3520ced
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/histo.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func histoFunction(c *cli.Context) error {
select {
case <-done:
return
case <-time.After(50 * time.Millisecond):
case <-time.After(100 * time.Millisecond):
if hasUpdates.Load().(bool) {
hasUpdates.Store(false)
mux.Lock()
Expand Down
10 changes: 8 additions & 2 deletions pkg/multiterm/histoWriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ func (s *HistoWriter) WriteForLine(line int, key string, val int64) {
func (s *HistoWriter) writeLine(line int, key string, val int64) {
if s.ShowBar {
progress := val * int64(len(progressSlice)) / s.maxVal
s.writer.WriteForLine(line, "%-[4]*[1]s %-10[2]d %[3]s", color.Wrap(color.Yellow, key), val, color.Wrap(color.Blue, progressSlice[:progress]), s.textSpacing)
s.writer.WriteForLine(line, "%[1]s %-10[2]d %[3]s",
color.Wrapf(color.Yellow, "%-[2]*[1]s", key, s.textSpacing),
val,
color.Wrap(color.Blue, progressSlice[:progress]),
s.textSpacing)
} else {
s.writer.WriteForLine(line, "%-[3]*[1]s %-10[2]d", key, val, s.textSpacing)
s.writer.WriteForLine(line, "%[1]s %-10[2]d",
color.Wrapf(color.Yellow, "%-[2]*[1]s", key, s.textSpacing),
val)
}
}

0 comments on commit 3520ced

Please sign in to comment.