From 13d3a1d863058dc90a56474478461547a60d6c44 Mon Sep 17 00:00:00 2001 From: Nathan Baulch Date: Sun, 27 Aug 2023 03:45:10 +1000 Subject: [PATCH] progress: render never started trackers properly (#273) --- .github/workflows/ci.yml | 2 +- README.md | 2 +- cmd/demo-progress/demo.go | 2 +- list/list.go | 12 ++---- list/render.go | 14 +++--- list/render_test.go | 1 - list/writer.go | 2 +- progress/progress.go | 4 +- progress/progress_test.go | 4 +- progress/render.go | 20 ++++----- progress/render_test.go | 86 +++++++++++++++++++++++-------------- progress/style.go | 68 ++++++++++++++--------------- progress/units.go | 16 +++---- progress/writer.go | 2 +- table/render_bidi_test.go | 1 - table/render_html.go | 4 +- table/render_init.go | 8 +--- table/render_markdown.go | 22 ++++------ table/style.go | 30 ++++++------- table/table.go | 29 +++++++------ table/util.go | 2 +- table/writer.go | 2 +- text/align.go | 2 +- text/ansi_windows.go | 4 +- text/color.go | 12 ++---- text/color_html.go | 90 +++++++++++++++++++-------------------- text/escape.go | 1 - text/transformer.go | 14 +++--- 28 files changed, 221 insertions(+), 235 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da20a9c..779b58c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - # Set up the GoLang enviroment + # Set up the GoLang environment - name: Set up Go uses: actions/setup-go@v2 with: diff --git a/README.md b/README.md index d49294a..af77db9 100644 --- a/README.md +++ b/README.md @@ -111,4 +111,4 @@ the following from within your code folder to do the same: ``` find . -type f -name "*.go" | grep -v vendor | xargs sed -i 's/jedib0t\/go-pretty\//jedib0t\/go-pretty\/v6\//g' ``` -If you are on MacOS, you'll have to use `sed -i ''` instead of `sed -i`. +If you are on macOS, you'll have to use `sed -i ''` instead of `sed -i`. diff --git a/cmd/demo-progress/demo.go b/cmd/demo-progress/demo.go index e6baa7a..0bc6b1d 100644 --- a/cmd/demo-progress/demo.go +++ b/cmd/demo-progress/demo.go @@ -97,7 +97,7 @@ func trackSomething(pw progress.Writer, idx int64, updateMessage bool) { } pw.SetPinnedMessages( fmt.Sprintf(">> Current Time: %-32s", time.Now().Format(time.RFC3339)), - fmt.Sprintf(">> Total Time: %-32s", time.Now().Sub(timeStart).Round(time.Millisecond)), + fmt.Sprintf(">> Total Time: %-32s", time.Since(timeStart).Round(time.Millisecond)), ) case <-updateTicker: if updateMessage { diff --git a/list/list.go b/list/list.go index 64e5393..9f8cffe 100644 --- a/list/list.go +++ b/list/list.go @@ -19,7 +19,7 @@ type listItem struct { Text string } -// List helps print a 2-dimensional array in a human readable pretty-List. +// List helps print a 2-dimensional array in a human-readable pretty-List. type List struct { // approxSize stores the approximate output length/size approxSize int @@ -71,7 +71,7 @@ func (l *List) Reset() { l.style = nil } -// SetHTMLCSSClass sets the the HTML CSS Class to use on the