diff --git a/decor/decorator.go b/decor/decorator.go index 77086a0..e4fd714 100644 --- a/decor/decorator.go +++ b/decor/decorator.go @@ -31,8 +31,12 @@ DSyncSpaceR = DSyncWidth | DextraSpace | DidentRight ) +// TimeStyle enum. +type TimeStyle int + +// TimeStyle kinds. const ( - ET_STYLE_GO = iota + ET_STYLE_GO TimeStyle = iota ET_STYLE_HHMMSS ET_STYLE_HHMM ET_STYLE_MMSS @@ -55,7 +59,7 @@ } // Syncable interface. -// All decorators implement this interface implicitly. Its Syncable +// All decorators implement this interface implicitly. Its Syncable // method exposes width sync channel, if sync is enabled. type Syncable interface { Syncable() (bool, chan int) diff --git a/decor/elapsed.go b/decor/elapsed.go index 649d40a..b2e7585 100644 --- a/decor/elapsed.go +++ b/decor/elapsed.go @@ -10,7 +10,7 @@ // `style` one of [ET_STYLE_GO|ET_STYLE_HHMMSS|ET_STYLE_HHMM|ET_STYLE_MMSS] // // `wcc` optional WC config -func Elapsed(style int, wcc ...WC) Decorator { +func Elapsed(style TimeStyle, wcc ...WC) Decorator { var wc WC for _, widthConf := range wcc { wc = widthConf @@ -26,7 +26,7 @@ type elapsedDecorator struct { WC - style int + style TimeStyle startTime time.Time msg string completeMsg *string diff --git a/decor/eta.go b/decor/eta.go index b4ab6be..e8dc979 100644 --- a/decor/eta.go +++ b/decor/eta.go @@ -17,7 +17,7 @@ // `age` is the previous N samples to average over. // // `wcc` optional WC config -func EwmaETA(style int, age float64, wcc ...WC) Decorator { +func EwmaETA(style TimeStyle, age float64, wcc ...WC) Decorator { return MovingAverageETA(style, ewma.NewMovingAverage(age), NopNormalizer(), wcc...) } @@ -30,7 +30,7 @@ // `normalizer` available implementations are [NopNormalizer|FixedIntervalTimeNormalizer|MaxTolerateTimeNormalizer] // // `wcc` optional WC config -func MovingAverageETA(style int, average MovingAverage, normalizer TimeNormalizer, wcc ...WC) Decorator { +func MovingAverageETA(style TimeStyle, average MovingAverage, normalizer TimeNormalizer, wcc ...WC) Decorator { var wc WC for _, widthConf := range wcc { wc = widthConf @@ -47,7 +47,7 @@ type movingAverageETA struct { WC - style int + style TimeStyle average ewma.MovingAverage completeMsg *string normalizer TimeNormalizer @@ -104,7 +104,7 @@ // `style` one of [ET_STYLE_GO|ET_STYLE_HHMMSS|ET_STYLE_HHMM|ET_STYLE_MMSS] // // `wcc` optional WC config -func AverageETA(style int, wcc ...WC) Decorator { +func AverageETA(style TimeStyle, wcc ...WC) Decorator { var wc WC for _, widthConf := range wcc { wc = widthConf @@ -120,7 +120,7 @@ type averageETA struct { WC - style int + style TimeStyle startTime time.Time completeMsg *string }