From 4764f7d7f6e38b2fb79fbdc7cf86eabfae96ab3d Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Fri, 8 Jul 2022 16:37:07 -0500 Subject: [PATCH] :art: Negate if for clarity --- internal/progressbar/new.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/internal/progressbar/new.go b/internal/progressbar/new.go index 8d9e433..4313b43 100644 --- a/internal/progressbar/new.go +++ b/internal/progressbar/new.go @@ -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 {