fix(deps): update module github.com/vbauerster/mpb/v8 to v8.7.0

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
renovate[bot]
2023-11-27 05:05:51 +00:00
committed by GitHub
parent 1486ee5189
commit c7f6844c02
5 changed files with 18 additions and 23 deletions

View File

@ -42,11 +42,9 @@ func main() {
mpb.BarStyle().Lbound("╢").Filler("▌").Tip("▌").Padding("░").Rbound("╟"),
mpb.PrependDecorators(
// display our name with one space on the right
decor.Name(name, decor.WC{W: len(name) + 1, C: decor.DidentRight}),
decor.Name(name, decor.WC{C: decor.DindentRight | decor.DextraSpace}),
// replace ETA decorator with "done" message, OnComplete event
decor.OnComplete(
decor.AverageETA(decor.ET_STYLE_GO, decor.WC{W: 4}), "done",
),
decor.OnComplete(decor.AverageETA(decor.ET_STYLE_GO), "done"),
),
mpb.AppendDecorators(decor.Percentage()),
)

View File

@ -8,29 +8,27 @@ import (
)
const (
// DidentRight bit specifies identation direction.
// DindentRight sets indentation from right to left.
//
// |foo |b | With DidentRight
// | foo| b| Without DidentRight
DidentRight = 1 << iota
// |foo |b | DindentRight is set
// | foo| b| DindentRight is not set
DindentRight = 1 << iota
// DextraSpace bit adds extra space, makes sense with DSyncWidth only.
// When DidentRight bit set, the space will be added to the right,
// otherwise to the left.
// DextraSpace bit adds extra indentation space.
DextraSpace
// DSyncWidth bit enables same column width synchronization.
// Effective with multiple bars only.
DSyncWidth
// DSyncWidthR is shortcut for DSyncWidth|DidentRight
DSyncWidthR = DSyncWidth | DidentRight
// DSyncWidthR is shortcut for DSyncWidth|DindentRight
DSyncWidthR = DSyncWidth | DindentRight
// DSyncSpace is shortcut for DSyncWidth|DextraSpace
DSyncSpace = DSyncWidth | DextraSpace
// DSyncSpaceR is shortcut for DSyncWidth|DextraSpace|DidentRight
DSyncSpaceR = DSyncWidth | DextraSpace | DidentRight
// DSyncSpaceR is shortcut for DSyncWidth|DextraSpace|DindentRight
DSyncSpaceR = DSyncWidth | DextraSpace | DindentRight
)
// TimeStyle enum.
@ -143,11 +141,10 @@ func (wc WC) Format(str string) (string, int) {
viewWidth := runewidth.StringWidth(str)
if wc.W > viewWidth {
viewWidth = wc.W
} else if (wc.C & DextraSpace) != 0 {
viewWidth++
}
if (wc.C & DSyncWidth) != 0 {
if (wc.C & DextraSpace) != 0 {
viewWidth++
}
wc.wsync <- viewWidth
viewWidth = <-wc.wsync
}
@ -156,7 +153,7 @@ func (wc WC) Format(str string) (string, int) {
// Init initializes width related config.
func (wc *WC) Init() WC {
if (wc.C & DidentRight) != 0 {
if (wc.C & DindentRight) != 0 {
wc.fill = runewidth.FillRight
} else {
wc.fill = runewidth.FillLeft