Skip to content

Commit

Permalink
🎨 Negate if for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Jul 9, 2022
1 parent 1df7859 commit 4764f7d
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions internal/progressbar/new.go
Expand Up @@ -10,19 +10,20 @@ import (
)

func New(max int64, label string) *progressbar.ProgressBar {
if !terminal.IsTTY() {
return progressbar.NewOptions64(
max,
progressbar.OptionSetDescription(label),
progressbar.OptionSetWriter(os.Stderr),
progressbar.OptionShowBytes(true),
progressbar.OptionSetWidth(10),
progressbar.OptionThrottle(2*time.Second),
progressbar.OptionShowCount(),
progressbar.OptionSpinnerType(14),
)
if terminal.IsTTY() {
return progressbar.DefaultBytes(max, label)
}
return progressbar.DefaultBytes(max, label)

return progressbar.NewOptions64(
max,
progressbar.OptionSetDescription(label),
progressbar.OptionSetWriter(os.Stderr),
progressbar.OptionShowBytes(true),
progressbar.OptionSetWidth(10),
progressbar.OptionThrottle(2*time.Second),
progressbar.OptionShowCount(),
progressbar.OptionSpinnerType(14),
)
}

func NewBarSafeLogger(w io.Writer, bar *progressbar.ProgressBar) *BarSafeLogger {
Expand Down

0 comments on commit 4764f7d

Please sign in to comment.