diff --git a/README.md b/README.md index a196a5f..ef50fc9 100644 --- a/README.md +++ b/README.md @@ -48,16 +48,15 @@ bar := p.AddBar(int64(total), // Prepending decorators mpb.PrependDecorators( - // StaticName decorator with minWidth and no width sync options + // StaticName decorator with minWidth and no extra config // If you need to change name while rendering, use DynamicName decor.StaticName(name, len(name), 0), - // ETA decorator with minWidth and width sync options - // DSyncSpace is shortcut for DwidthSync|DextraSpace - decor.ETA(4, decor.DSyncSpace), + // ETA decorator with minWidth and no extra config + decor.ETA(4, 0), ), // Appending decorators mpb.AppendDecorators( - // Percentage decorator with minWidth and no width sync options + // Percentage decorator with minWidth and no extra config decor.Percentage(5, 0), ), ) diff --git a/decor/decorators.go b/decor/decorators.go index cb98b5b..d97a67b 100644 --- a/decor/decorators.go +++ b/decor/decorators.go @@ -62,7 +62,9 @@ } // DynamicName to be used, when there is a plan to change the name once or -// several times during progress rendering process +// several times during progress rendering process. If there're more than one +// bar, and you'd like to synchronize column width, conf param shauld have +// DwidthSync bit set. func DynamicName(nameFn func(*Statistics) string, minWidth int, conf byte) DecoratorFunc { format := "%%" if (conf & DidentRight) != 0 { @@ -86,7 +88,8 @@ // Counters provides basic counters decorator. // Accepts pairFormat string, something like "%s / %s" to be used in // fmt.Sprintf(pairFormat, current, total) and one of (Unit_KiB/Unit_kB) -// constant +// constant. If there're more than one bar, and you'd like to synchronize column +// width, conf param shauld have DwidthSync bit set. func Counters(pairFormat string, unit Units, minWidth int, conf byte) DecoratorFunc { format := "%%" if (conf & DidentRight) != 0 { @@ -109,6 +112,9 @@ } } +// ETA provides exponential-weighted-moving-average ETA decorator. +// If there're more than one bar, and you'd like to synchronize column width, +// conf param shauld have DwidthSync bit set. func ETA(minWidth int, conf byte) DecoratorFunc { format := "%%" if (conf & DidentRight) != 0 { @@ -129,6 +135,9 @@ } } +// Elapsed provides elapsed time decorator. +// If there're more than one bar, and you'd like to synchronize column width, +// conf param shauld have DwidthSync bit set. func Elapsed(minWidth int, conf byte) DecoratorFunc { format := "%%" if (conf & DidentRight) != 0 { @@ -149,6 +158,9 @@ } } +// Percentage provides percentage decorator. +// If there're more than one bar, and you'd like to synchronize column width, +// conf param shauld have DwidthSync bit set. func Percentage(minWidth int, conf byte) DecoratorFunc { format := "%%" if (conf & DidentRight) != 0 { diff --git a/example_test.go b/example_test.go index cea3ad7..70eff0c 100644 --- a/example_test.go +++ b/example_test.go @@ -25,16 +25,15 @@ bar := p.AddBar(int64(total), // Prepending decorators mpb.PrependDecorators( - // StaticName decorator with minWidth and no width sync options + // StaticName decorator with minWidth and no extra config // If you need to change name while rendering, use DynamicName decor.StaticName(name, len(name), 0), - // ETA decorator with minWidth and width sync options - // DSyncSpace is shortcut for DwidthSync|DextraSpace - decor.ETA(4, decor.DSyncSpace), + // ETA decorator with minWidth and no extra config + decor.ETA(4, 0), ), // Appending decorators mpb.AppendDecorators( - // Percentage decorator with minWidth and no width sync options + // Percentage decorator with minWidth and no extra config decor.Percentage(5, 0), ), ) diff --git a/examples/singleBar/main.go b/examples/singleBar/main.go index 1a49b89..7b996b7 100644 --- a/examples/singleBar/main.go +++ b/examples/singleBar/main.go @@ -25,16 +25,15 @@ bar := p.AddBar(int64(total), // Prepending decorators mpb.PrependDecorators( - // StaticName decorator with minWidth and no width sync options + // StaticName decorator with minWidth and no extra config // If you need to change name while rendering, use DynamicName decor.StaticName(name, len(name), 0), - // ETA decorator with minWidth and width sync options - // DSyncSpace is shortcut for DwidthSync|DextraSpace - decor.ETA(4, decor.DSyncSpace), + // ETA decorator with minWidth and no extra config + decor.ETA(4, 0), ), // Appending decorators mpb.AppendDecorators( - // Percentage decorator with minWidth and no width sync options + // Percentage decorator with minWidth and no extra config decor.Percentage(5, 0), ), )