From 46c8fbc11a3f3ca582f74b52610555eaaa10db1a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Aug 2023 10:27:13 -0400 Subject: [PATCH] chore(deps): bump github.com/pterm/pterm from 0.12.63 to 0.12.66 (#261) Bumps [github.com/pterm/pterm](https://github.com/pterm/pterm) from 0.12.63 to 0.12.66. - [Release notes](https://github.com/pterm/pterm/releases) - [Changelog](https://github.com/pterm/pterm/blob/master/CHANGELOG.md) - [Commits](https://github.com/pterm/pterm/compare/v0.12.63...v0.12.66) --- updated-dependencies: - dependency-name: github.com/pterm/pterm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 9 +- go.sum | 23 +- vendor/atomicgo.dev/cursor/README.md | 304 ++++++++++++++++-- vendor/atomicgo.dev/cursor/area.go | 153 +++++++-- vendor/atomicgo.dev/cursor/area_other.go | 13 + vendor/atomicgo.dev/cursor/area_windows.go | 21 ++ vendor/atomicgo.dev/cursor/cursor.go | 70 +--- vendor/atomicgo.dev/cursor/cursor_other.go | 67 ++++ vendor/atomicgo.dev/cursor/cursor_windows.go | 70 ++-- vendor/atomicgo.dev/cursor/go.work | 10 + vendor/atomicgo.dev/cursor/utils.go | 91 +++++- vendor/atomicgo.dev/schedule/.golangci.yml | 53 ++- vendor/atomicgo.dev/schedule/README.md | 90 +++--- vendor/atomicgo.dev/schedule/schedule.go | 4 +- vendor/github.com/gookit/color/color_16.go | 49 ++- vendor/github.com/gookit/color/color_256.go | 20 +- vendor/github.com/gookit/color/color_rgb.go | 15 +- vendor/github.com/gookit/color/convert.go | 24 +- vendor/github.com/gookit/color/style.go | 6 +- vendor/github.com/pterm/pterm/CHANGELOG.md | 17 +- vendor/github.com/pterm/pterm/README.md | 169 +++++++++- vendor/github.com/pterm/pterm/area_printer.go | 6 + .../pterm/interactive_confirm_printer.go | 39 ++- .../pterm/interactive_continue_printer.go | 34 +- .../pterm/interactive_textinput_printer.go | 52 +-- .../pterm/pterm/interface_live_printer.go | 4 + .../pterm/pterm/multi_live_printer.go | 124 +++++++ .../pterm/pterm/progressbar_printer.go | 60 ++-- .../github.com/pterm/pterm/spinner_printer.go | 14 +- vendor/modules.txt | 10 +- 30 files changed, 1259 insertions(+), 362 deletions(-) create mode 100644 vendor/atomicgo.dev/cursor/area_other.go create mode 100644 vendor/atomicgo.dev/cursor/area_windows.go create mode 100644 vendor/atomicgo.dev/cursor/cursor_other.go create mode 100644 vendor/atomicgo.dev/cursor/go.work create mode 100644 vendor/github.com/pterm/pterm/multi_live_printer.go diff --git a/go.mod b/go.mod index e09610bf..a5ccf169 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( ) require ( - atomicgo.dev/schedule v0.0.2 // indirect + atomicgo.dev/schedule v0.1.0 // indirect dario.cat/mergo v1.0.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect @@ -43,7 +43,6 @@ require ( github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/skeema/knownhosts v1.2.0 // indirect - github.com/stretchr/testify v1.8.1 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect golang.org/x/crypto v0.11.0 // indirect golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 // indirect @@ -54,13 +53,13 @@ require ( ) require ( - atomicgo.dev/cursor v0.1.3 // indirect + atomicgo.dev/cursor v0.2.0 // indirect atomicgo.dev/keyboard v0.2.9 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect github.com/fitv/go-i18n v1.0.4 github.com/go-git/go-git/v5 v5.8.1 - github.com/gookit/color v1.5.3 // indirect + github.com/gookit/color v1.5.4 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/lithammer/fuzzysearch v1.1.8 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect @@ -69,7 +68,7 @@ require ( github.com/muesli/reflow v0.3.0 // indirect github.com/muesli/termenv v0.15.2 // indirect github.com/pkg/errors v0.9.1 - github.com/pterm/pterm v0.12.63 + github.com/pterm/pterm v0.12.66 github.com/rivo/uniseg v0.4.4 // indirect github.com/spf13/pflag v1.0.5 github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect diff --git a/go.sum b/go.sum index 6e0794bc..36cfe51e 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,10 @@ atomicgo.dev/assert v0.0.2 h1:FiKeMiZSgRrZsPo9qn/7vmr7mCsh5SZyXY4YGYiYwrg= -atomicgo.dev/cursor v0.1.3 h1:w8GcylMdZRyFzvDiGm3wy3fhZYYT7BwaqNjUFHxo0NU= -atomicgo.dev/cursor v0.1.3/go.mod h1:Lr4ZJB3U7DfPPOkbH7/6TOtJ4vFGHlgj1nc+n900IpU= +atomicgo.dev/cursor v0.2.0 h1:H6XN5alUJ52FZZUkI7AlJbUc1aW38GWZalpYRPpoPOw= +atomicgo.dev/cursor v0.2.0/go.mod h1:Lr4ZJB3U7DfPPOkbH7/6TOtJ4vFGHlgj1nc+n900IpU= atomicgo.dev/keyboard v0.2.9 h1:tOsIid3nlPLZ3lwgG8KZMp/SFmr7P0ssEN5JUsm78K8= atomicgo.dev/keyboard v0.2.9/go.mod h1:BC4w9g00XkxH/f1HXhW2sXmJFOCWbKn9xrOunSFtExQ= -atomicgo.dev/schedule v0.0.2 h1:2e/4KY6t3wokja01Cyty6qgkQM8MotJzjtqCH70oX2Q= -atomicgo.dev/schedule v0.0.2/go.mod h1:xeUa3oAkiuHYh8bKiQBRojqAMq3PXXbJujjb0hw8pEU= +atomicgo.dev/schedule v0.1.0 h1:nTthAbhZS5YZmgYbb2+DH8uQIZcTlIrd4eYr3UQxEjs= +atomicgo.dev/schedule v0.1.0/go.mod h1:xeUa3oAkiuHYh8bKiQBRojqAMq3PXXbJujjb0hw8pEU= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/MarvinJWendt/testza v0.1.0/go.mod h1:7AxNvlfeHP7Z/hDQ5JtE3OKYT3XFUeLCDE2DQninSqs= @@ -72,8 +72,8 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ= github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl7wAo= -github.com/gookit/color v1.5.3 h1:twfIhZs4QLCtimkP7MOxlF3A0U/5cDPseRT9M/+2SCE= -github.com/gookit/color v1.5.3/go.mod h1:NUzwzeehUfl7GIb36pqId+UGmRfQcU/WiiyTTeNjHtE= +github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0= +github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -143,8 +143,8 @@ github.com/pterm/pterm v0.12.31/go.mod h1:32ZAWZVXD7ZfG0s8qqHXePte42kdz8ECtRyEej github.com/pterm/pterm v0.12.33/go.mod h1:x+h2uL+n7CP/rel9+bImHD5lF3nM9vJj80k9ybiiTTE= github.com/pterm/pterm v0.12.36/go.mod h1:NjiL09hFhT/vWjQHSj1athJpx6H8cjpHXNAK5bUw8T8= github.com/pterm/pterm v0.12.40/go.mod h1:ffwPLwlbXxP+rxT0GsgDTzS3y3rmpAO1NMjUkGTYf8s= -github.com/pterm/pterm v0.12.63 h1:fHlrpFiI9qLtEU0TWDWMU+tAt4qKJ/s157BEAPtGm8w= -github.com/pterm/pterm v0.12.63/go.mod h1:Bq1eoUJ6BhUzzXG8WxA4l7T3s7d3Ogwg7v9VXlsVat0= +github.com/pterm/pterm v0.12.66 h1:bjsoMyUstaarzJ1NG7+1HGT7afR0JVMYsR3ooPeh4bo= +github.com/pterm/pterm v0.12.66/go.mod h1:nFuT9ZVkkCi8o4L1dtWuYPwDQxggLh4C263qG5nTLpQ= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= @@ -165,16 +165,11 @@ github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRM github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= diff --git a/vendor/atomicgo.dev/cursor/README.md b/vendor/atomicgo.dev/cursor/README.md index 9760feff..0f799745 100644 --- a/vendor/atomicgo.dev/cursor/README.md +++ b/vendor/atomicgo.dev/cursor/README.md @@ -78,6 +78,7 @@ Special thanks to github.com/k0kubun/go\-ansi which this project is based on. ## Index - [func Bottom\(\)](<#Bottom>) +- [func Clear\(\)](<#Clear>) - [func ClearLine\(\)](<#ClearLine>) - [func ClearLinesDown\(n int\)](<#ClearLinesDown>) - [func ClearLinesUp\(n int\)](<#ClearLinesUp>) @@ -98,14 +99,38 @@ Special thanks to github.com/k0kubun/go\-ansi which this project is based on. - [func UpAndClear\(n int\)](<#UpAndClear>) - [type Area](<#Area>) - [func NewArea\(\) Area](<#NewArea>) + - [func \(area \*Area\) Bottom\(\)](<#Area.Bottom>) - [func \(area \*Area\) Clear\(\)](<#Area.Clear>) + - [func \(area \*Area\) ClearLinesDown\(n int\)](<#Area.ClearLinesDown>) + - [func \(area \*Area\) ClearLinesUp\(n int\)](<#Area.ClearLinesUp>) + - [func \(area \*Area\) Down\(n int\)](<#Area.Down>) + - [func \(area \*Area\) DownAndClear\(n int\)](<#Area.DownAndClear>) + - [func \(area \*Area\) Move\(x, y int\)](<#Area.Move>) + - [func \(area \*Area\) StartOfLine\(\)](<#Area.StartOfLine>) + - [func \(area \*Area\) StartOfLineDown\(n int\)](<#Area.StartOfLineDown>) + - [func \(area \*Area\) StartOfLineUp\(n int\)](<#Area.StartOfLineUp>) + - [func \(area \*Area\) Top\(\)](<#Area.Top>) + - [func \(area \*Area\) Up\(n int\)](<#Area.Up>) + - [func \(area \*Area\) UpAndClear\(n int\)](<#Area.UpAndClear>) - [func \(area \*Area\) Update\(content string\)](<#Area.Update>) - [func \(area Area\) WithWriter\(writer Writer\) Area](<#Area.WithWriter>) +- [type Cursor](<#Cursor>) + - [func NewCursor\(\) \*Cursor](<#NewCursor>) + - [func \(c \*Cursor\) Clear\(\)](<#Cursor.Clear>) + - [func \(c \*Cursor\) ClearLine\(\)](<#Cursor.ClearLine>) + - [func \(c \*Cursor\) Down\(n int\)](<#Cursor.Down>) + - [func \(c \*Cursor\) Hide\(\)](<#Cursor.Hide>) + - [func \(c \*Cursor\) HorizontalAbsolute\(n int\)](<#Cursor.HorizontalAbsolute>) + - [func \(c \*Cursor\) Left\(n int\)](<#Cursor.Left>) + - [func \(c \*Cursor\) Right\(n int\)](<#Cursor.Right>) + - [func \(c \*Cursor\) Show\(\)](<#Cursor.Show>) + - [func \(c \*Cursor\) Up\(n int\)](<#Cursor.Up>) + - [func \(c \*Cursor\) WithWriter\(w Writer\) \*Cursor](<#Cursor.WithWriter>) - [type Writer](<#Writer>) -## func [Bottom]() +## func [Bottom]() ```go func Bottom() @@ -113,8 +138,17 @@ func Bottom() Bottom moves the cursor to the bottom of the terminal. This is done by calculating how many lines were moved by Up and Down. + +## func [Clear]() + +```go +func Clear() +``` + +Clear clears the current position and moves the cursor to the left. + -## func [ClearLine]() +## func [ClearLine]() ```go func ClearLine() @@ -123,7 +157,7 @@ func ClearLine() ClearLine clears the current line and moves the cursor to it's start position. -## func [ClearLinesDown]() +## func [ClearLinesDown]() ```go func ClearLinesDown(n int) @@ -132,7 +166,7 @@ func ClearLinesDown(n int) ClearLinesDown clears n lines downwards from the current position and moves the cursor. -## func [ClearLinesUp]() +## func [ClearLinesUp]() ```go func ClearLinesUp(n int) @@ -141,7 +175,7 @@ func ClearLinesUp(n int) ClearLinesUp clears n lines upwards from the current position and moves the cursor. -## func [Down]() +## func [Down]() ```go func Down(n int) @@ -150,7 +184,7 @@ func Down(n int) Down moves the cursor n lines down relative to the current position. -## func [DownAndClear]() +## func [DownAndClear]() ```go func DownAndClear(n int) @@ -159,7 +193,7 @@ func DownAndClear(n int) DownAndClear moves the cursor down by n lines, then clears the line. -## func [Hide]() +## func [Hide]() ```go func Hide() @@ -168,7 +202,7 @@ func Hide() Hide the cursor. Don't forget to show the cursor at least at the end of your application with Show. Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal. -## func [HorizontalAbsolute]() +## func [HorizontalAbsolute]() ```go func HorizontalAbsolute(n int) @@ -177,7 +211,7 @@ func HorizontalAbsolute(n int) HorizontalAbsolute moves the cursor to n horizontally. The position n is absolute to the start of the line. -## func [Left]() +## func [Left]() ```go func Left(n int) @@ -186,7 +220,7 @@ func Left(n int) Left moves the cursor n characters to the left relative to the current position. -## func [Move]() +## func [Move]() ```go func Move(x, y int) @@ -195,7 +229,7 @@ func Move(x, y int) Move moves the cursor relative by x and y. -## func [Right]() +## func [Right]() ```go func Right(n int) @@ -204,16 +238,16 @@ func Right(n int) Right moves the cursor n characters to the right relative to the current position. -## func [SetTarget]() +## func [SetTarget]() ```go func SetTarget(w Writer) ``` -SetTarget allows for any arbitrary io.Writer to be used for cursor movement \(will not work on Windows\). +SetTarget sets to output target of the default curser to the provided cursor.Writer \(wrapping io.Writer\). -## func [Show]() +## func [Show]() ```go func Show() @@ -222,7 +256,7 @@ func Show() Show the cursor if it was hidden previously. Don't forget to show the cursor at least at the end of your application. Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal. -## func [StartOfLine]() +## func [StartOfLine]() ```go func StartOfLine() @@ -231,7 +265,7 @@ func StartOfLine() StartOfLine moves the cursor to the start of the current line. -## func [StartOfLineDown]() +## func [StartOfLineDown]() ```go func StartOfLineDown(n int) @@ -240,7 +274,7 @@ func StartOfLineDown(n int) StartOfLineDown moves the cursor down by n lines, then moves to cursor to the start of the line. -## func [StartOfLineUp]() +## func [StartOfLineUp]() ```go func StartOfLineUp(n int) @@ -258,7 +292,7 @@ func TestCustomIOWriter(t *testing.T) TestCustomIOWriter tests the cursor functions with a custom Writer. -## func [Up]() +## func [Up]() ```go func Up(n int) @@ -267,7 +301,7 @@ func Up(n int) Up moves the cursor n lines up relative to the current position. -## func [UpAndClear]() +## func [UpAndClear]() ```go func UpAndClear(n int) @@ -276,7 +310,7 @@ func UpAndClear(n int) UpAndClear moves the cursor up by n lines, then clears the line. -## type [Area]() +## type [Area]() Area displays content which can be updated on the fly. You can use this to create live output, charts, dropdowns, etc. @@ -295,8 +329,17 @@ func NewArea() Area NewArea returns a new Area. + +### func \(\*Area\) [Bottom]() + +```go +func (area *Area) Bottom() +``` + +Bottom moves the cursor to the bottom of the terminal. This is done by calculating how many lines were moved by Up and Down. + -### func \(\*Area\) [Clear]() +### func \(\*Area\) [Clear]() ```go func (area *Area) Clear() @@ -304,26 +347,235 @@ func (area *Area) Clear() Clear clears the content of the Area. + +### func \(\*Area\) [ClearLinesDown]() + +```go +func (area *Area) ClearLinesDown(n int) +``` + +ClearLinesDown clears n lines downwards from the current position and moves the cursor. + + +### func \(\*Area\) [ClearLinesUp]() + +```go +func (area *Area) ClearLinesUp(n int) +``` + +ClearLinesUp clears n lines upwards from the current position and moves the cursor. + + +### func \(\*Area\) [Down]() + +```go +func (area *Area) Down(n int) +``` + +Down moves the cursor of the area down one line. + + +### func \(\*Area\) [DownAndClear]() + +```go +func (area *Area) DownAndClear(n int) +``` + +DownAndClear moves the cursor down by n lines, then clears the line. + + +### func \(\*Area\) [Move]() + +```go +func (area *Area) Move(x, y int) +``` + +Move moves the cursor relative by x and y. + + +### func \(\*Area\) [StartOfLine]() + +```go +func (area *Area) StartOfLine() +``` + +StartOfLine moves the cursor to the start of the current line. + + +### func \(\*Area\) [StartOfLineDown]() + +```go +func (area *Area) StartOfLineDown(n int) +``` + +StartOfLineDown moves the cursor down by n lines, then moves to cursor to the start of the line. + + +### func \(\*Area\) [StartOfLineUp]() + +```go +func (area *Area) StartOfLineUp(n int) +``` + +StartOfLineUp moves the cursor up by n lines, then moves to cursor to the start of the line. + + +### func \(\*Area\) [Top]() + +```go +func (area *Area) Top() +``` + +Top moves the cursor to the top of the area. This is done by calculating how many lines were moved by Up and Down. + + +### func \(\*Area\) [Up]() + +```go +func (area *Area) Up(n int) +``` + +Up moves the cursor of the area up one line. + + +### func \(\*Area\) [UpAndClear]() + +```go +func (area *Area) UpAndClear(n int) +``` + +UpAndClear moves the cursor up by n lines, then clears the line. + -### func \(\*Area\) [Update]() +### func \(\*Area\) [Update]() ```go func (area *Area) Update(content string) ``` -Update overwrites the content of the Area. +Update overwrites the content of the Area and adjusts its height based on content. -### func \(Area\) [WithWriter]() +### func \(Area\) [WithWriter]() ```go func (area Area) WithWriter(writer Writer) Area ``` -WithWriter sets a custom writer for the Area. +WithWriter sets the custom writer. + + +## type [Cursor]() + +Cursor displays content which can be updated on the fly. You can use this to create live output, charts, dropdowns, etc. + +```go +type Cursor struct { + // contains filtered or unexported fields +} +``` + + +### func [NewCursor]() + +```go +func NewCursor() *Cursor +``` + +NewCursor creates a new Cursor instance writing to os.Stdout. + + +### func \(\*Cursor\) [Clear]() + +```go +func (c *Cursor) Clear() +``` + +Clear clears the current position and moves the cursor to the left. + + +### func \(\*Cursor\) [ClearLine]() + +```go +func (c *Cursor) ClearLine() +``` + +ClearLine clears the current line and moves the cursor to it's start position. + + +### func \(\*Cursor\) [Down]() + +```go +func (c *Cursor) Down(n int) +``` + +Down moves the cursor n lines down relative to the current position. + + +### func \(\*Cursor\) [Hide]() + +```go +func (c *Cursor) Hide() +``` + +Hide the cursor. Don't forget to show the cursor at least at the end of your application with Show. Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal. + + +### func \(\*Cursor\) [HorizontalAbsolute]() + +```go +func (c *Cursor) HorizontalAbsolute(n int) +``` + +HorizontalAbsolute moves the cursor to n horizontally. The position n is absolute to the start of the line. + + +### func \(\*Cursor\) [Left]() + +```go +func (c *Cursor) Left(n int) +``` + +Left moves the cursor n characters to the left relative to the current position. + + +### func \(\*Cursor\) [Right]() + +```go +func (c *Cursor) Right(n int) +``` + +Right moves the cursor n characters to the right relative to the current position. + + +### func \(\*Cursor\) [Show]() + +```go +func (c *Cursor) Show() +``` + +Show the cursor if it was hidden previously. Don't forget to show the cursor at least at the end of your application. Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal. + + +### func \(\*Cursor\) [Up]() + +```go +func (c *Cursor) Up(n int) +``` + +Up moves the cursor n lines up relative to the current position. + + +### func \(\*Cursor\) [WithWriter]() + +```go +func (c *Cursor) WithWriter(w Writer) *Cursor +``` + +WithWriter allows for any arbitrary Writer to be used for cursor movement abstracted. -## type [Writer]() +## type [Writer]() Writer is an expanded io.Writer interface with a file descriptor. diff --git a/vendor/atomicgo.dev/cursor/area.go b/vendor/atomicgo.dev/cursor/area.go index b0905764..5b26b5db 100644 --- a/vendor/atomicgo.dev/cursor/area.go +++ b/vendor/atomicgo.dev/cursor/area.go @@ -1,67 +1,164 @@ package cursor import ( - "fmt" "os" - "runtime" "strings" ) // Area displays content which can be updated on the fly. // You can use this to create live output, charts, dropdowns, etc. type Area struct { - height int - writer Writer + height int + writer Writer + cursor *Cursor + cursorPosY int } // NewArea returns a new Area. func NewArea() Area { return Area{ - writer: os.Stdout, - height: 0, + height: 0, + writer: os.Stdout, + cursor: cursor, + cursorPosY: 0, } } -// WithWriter sets a custom writer for the Area. +// WithWriter sets the custom writer. func (area Area) WithWriter(writer Writer) Area { area.writer = writer + area.cursor = area.cursor.WithWriter(writer) return area } // Clear clears the content of the Area. func (area *Area) Clear() { - Bottom() + // Initialize writer if not done yet + if area.writer == nil { + area.writer = os.Stdout + } if area.height > 0 { - ClearLinesUp(area.height) + area.Bottom() + area.ClearLinesUp(area.height) + area.StartOfLine() + } else { + area.StartOfLine() + area.cursor.ClearLine() } } -// Update overwrites the content of the Area. +// Update overwrites the content of the Area and adjusts its height based on content. func (area *Area) Update(content string) { - oldWriter := target - - SetTarget(area.writer) // Temporary set the target to the Area's writer so we can use the cursor functions area.Clear() + area.writeArea(content) + area.cursorPosY = 0 + area.height = strings.Count(content, "\n") +} - lines := strings.Split(content, "\n") - fmt.Fprintln(area.writer, strings.Repeat("\n", len(lines)-1)) // This appends space if the terminal is at the bottom - Up(len(lines)) - SetTarget(oldWriter) // Reset the target to the old writer - - // Workaround for buggy behavior on Windows - if runtime.GOOS == "windows" { - for _, line := range lines { - fmt.Fprint(area.writer, line) - StartOfLineDown(1) +// Up moves the cursor of the area up one line. +func (area *Area) Up(n int) { + if n > 0 { + if area.cursorPosY+n > area.height { + n = area.height - area.cursorPosY } - } else { - for _, line := range lines { - fmt.Fprintln(area.writer, line) + + area.cursor.Up(n) + area.cursorPosY += n + } +} + +// Down moves the cursor of the area down one line. +func (area *Area) Down(n int) { + if n > 0 { + if area.cursorPosY-n < 0 { + n = area.height - area.cursorPosY } + + area.cursor.Down(n) + area.cursorPosY -= n + } +} + +// Bottom moves the cursor to the bottom of the terminal. +// This is done by calculating how many lines were moved by Up and Down. +func (area *Area) Bottom() { + if area.cursorPosY > 0 { + area.Down(area.cursorPosY) + area.cursorPosY = 0 + } +} + +// Top moves the cursor to the top of the area. +// This is done by calculating how many lines were moved by Up and Down. +func (area *Area) Top() { + if area.cursorPosY < area.height { + area.Up(area.height - area.cursorPosY) + area.cursorPosY = area.height } +} + +// StartOfLine moves the cursor to the start of the current line. +func (area *Area) StartOfLine() { + area.cursor.HorizontalAbsolute(0) +} - height = 0 - area.height = len(strings.Split(content, "\n")) +// StartOfLineDown moves the cursor down by n lines, then moves to cursor to the start of the line. +func (area *Area) StartOfLineDown(n int) { + area.Down(n) + area.StartOfLine() +} + +// StartOfLineUp moves the cursor up by n lines, then moves to cursor to the start of the line. +func (area *Area) StartOfLineUp(n int) { + area.Up(n) + area.StartOfLine() +} + +// UpAndClear moves the cursor up by n lines, then clears the line. +func (area *Area) UpAndClear(n int) { + area.Up(n) + area.cursor.ClearLine() +} + +// DownAndClear moves the cursor down by n lines, then clears the line. +func (area *Area) DownAndClear(n int) { + area.Down(n) + area.cursor.ClearLine() +} + +// Move moves the cursor relative by x and y. +func (area *Area) Move(x, y int) { + if x > 0 { + area.cursor.Right(x) + } else if x < 0 { + area.cursor.Left(-x) + } + + if y > 0 { + area.Up(y) + } else if y < 0 { + area.Down(-y) + } +} + +// ClearLinesUp clears n lines upwards from the current position and moves the cursor. +func (area *Area) ClearLinesUp(n int) { + area.StartOfLine() + area.cursor.ClearLine() + + for i := 0; i < n; i++ { + area.UpAndClear(1) + } +} + +// ClearLinesDown clears n lines downwards from the current position and moves the cursor. +func (area *Area) ClearLinesDown(n int) { + area.StartOfLine() + area.cursor.ClearLine() + + for i := 0; i < n; i++ { + area.DownAndClear(1) + } } diff --git a/vendor/atomicgo.dev/cursor/area_other.go b/vendor/atomicgo.dev/cursor/area_other.go new file mode 100644 index 00000000..b92390de --- /dev/null +++ b/vendor/atomicgo.dev/cursor/area_other.go @@ -0,0 +1,13 @@ +//go:build !windows +// +build !windows + +package cursor + +import ( + "fmt" +) + +// Update overwrites the content of the Area and adjusts its height based on content. +func (area *Area) writeArea(content string) { + fmt.Fprint(area.writer, content) +} diff --git a/vendor/atomicgo.dev/cursor/area_windows.go b/vendor/atomicgo.dev/cursor/area_windows.go new file mode 100644 index 00000000..de7dd292 --- /dev/null +++ b/vendor/atomicgo.dev/cursor/area_windows.go @@ -0,0 +1,21 @@ +//go:build windows +// +build windows + +package cursor + +import ( + "fmt" +) + +// writeArea is a helper for platform dependant output. +// For Windows newlines '\n' in the content are replaced by '\r\n' +func (area *Area) writeArea(content string) { + last := ' ' + for _, r := range content { + if r == '\n' && last != '\r' { + fmt.Fprint(area.writer, "\r\n") + continue + } + fmt.Fprint(area.writer, string(r)) + } +} diff --git a/vendor/atomicgo.dev/cursor/cursor.go b/vendor/atomicgo.dev/cursor/cursor.go index e59e968b..89a3efcf 100644 --- a/vendor/atomicgo.dev/cursor/cursor.go +++ b/vendor/atomicgo.dev/cursor/cursor.go @@ -1,70 +1,26 @@ -//go:build !windows -// +build !windows - package cursor import ( - "fmt" "os" ) -var target Writer = os.Stdout - -// SetTarget allows for any arbitrary io.Writer to be used -// for cursor movement (will not work on Windows). -func SetTarget(w Writer) { - target = w +// Cursor displays content which can be updated on the fly. +// You can use this to create live output, charts, dropdowns, etc. +type Cursor struct { + writer Writer } -// Up moves the cursor n lines up relative to the current position. -func Up(n int) { - fmt.Fprintf(target, "\x1b[%dA", n) - height += n +// NewCursor creates a new Cursor instance writing to os.Stdout. +func NewCursor() *Cursor { + return &Cursor{writer: os.Stdout} } -// Down moves the cursor n lines down relative to the current position. -func Down(n int) { - fmt.Fprintf(target, "\x1b[%dB", n) - - if height-n <= 0 { - height = 0 - } else { - height -= n +// WithWriter allows for any arbitrary Writer to be used +// for cursor movement abstracted. +func (c *Cursor) WithWriter(w Writer) *Cursor { + if w != nil { + c.writer = w } -} - -// Right moves the cursor n characters to the right relative to the current position. -func Right(n int) { - fmt.Fprintf(target, "\x1b[%dC", n) -} - -// Left moves the cursor n characters to the left relative to the current position. -func Left(n int) { - fmt.Fprintf(target, "\x1b[%dD", n) -} - -// HorizontalAbsolute moves the cursor to n horizontally. -// The position n is absolute to the start of the line. -func HorizontalAbsolute(n int) { - n++ // Moves the line to the character after n - fmt.Fprintf(target, "\x1b[%dG", n) -} - -// Show the cursor if it was hidden previously. -// Don't forget to show the cursor at least at the end of your application. -// Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal. -func Show() { - fmt.Fprint(target, "\x1b[?25h") -} - -// Hide the cursor. -// Don't forget to show the cursor at least at the end of your application with Show. -// Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal. -func Hide() { - fmt.Fprintf(target, "\x1b[?25l") -} -// ClearLine clears the current line and moves the cursor to it's start position. -func ClearLine() { - fmt.Fprintf(target, "\x1b[2K") + return c } diff --git a/vendor/atomicgo.dev/cursor/cursor_other.go b/vendor/atomicgo.dev/cursor/cursor_other.go new file mode 100644 index 00000000..7c185578 --- /dev/null +++ b/vendor/atomicgo.dev/cursor/cursor_other.go @@ -0,0 +1,67 @@ +//go:build !windows +// +build !windows + +package cursor + +import ( + "fmt" +) + +// Up moves the cursor n lines up relative to the current position. +func (c *Cursor) Up(n int) { + if n > 0 { + fmt.Fprintf(c.writer, "\x1b[%dA", n) + } +} + +// Down moves the cursor n lines down relative to the current position. +func (c *Cursor) Down(n int) { + if n > 0 { + fmt.Fprintf(c.writer, "\x1b[%dB", n) + } +} + +// Right moves the cursor n characters to the right relative to the current position. +func (c *Cursor) Right(n int) { + if n > 0 { + fmt.Fprintf(c.writer, "\x1b[%dC", n) + } +} + +// Left moves the cursor n characters to the left relative to the current position. +func (c *Cursor) Left(n int) { + if n > 0 { + fmt.Fprintf(c.writer, "\x1b[%dD", n) + } +} + +// HorizontalAbsolute moves the cursor to n horizontally. +// The position n is absolute to the start of the line. +func (c *Cursor) HorizontalAbsolute(n int) { + n++ // Moves the line to the character after n + fmt.Fprintf(c.writer, "\x1b[%dG", n) +} + +// Show the cursor if it was hidden previously. +// Don't forget to show the cursor at least at the end of your application. +// Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal. +func (c *Cursor) Show() { + fmt.Fprint(c.writer, "\x1b[?25h") +} + +// Hide the cursor. +// Don't forget to show the cursor at least at the end of your application with Show. +// Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal. +func (c *Cursor) Hide() { + fmt.Fprintf(c.writer, "\x1b[?25l") +} + +// ClearLine clears the current line and moves the cursor to it's start position. +func (c *Cursor) ClearLine() { + fmt.Fprintf(c.writer, "\x1b[2K") +} + +// Clear clears the current position and moves the cursor to the left. +func (c *Cursor) Clear() { + fmt.Fprintf(c.writer, "\x1b[K") +} diff --git a/vendor/atomicgo.dev/cursor/cursor_windows.go b/vendor/atomicgo.dev/cursor/cursor_windows.go index 9a6173ba..ebe2bc59 100644 --- a/vendor/atomicgo.dev/cursor/cursor_windows.go +++ b/vendor/atomicgo.dev/cursor/cursor_windows.go @@ -1,46 +1,35 @@ +//go:build windows +// +build windows + package cursor import ( - "os" "syscall" "unsafe" ) -var target Writer = os.Stdout - -// SetTarget allows for any arbitrary Writer to be used -func SetTarget(w Writer) { - target = w -} - // Up moves the cursor n lines up relative to the current position. -func Up(n int) { - move(0, -n) - height += n +func (c *Cursor) Up(n int) { + c.move(0, -n) } // Down moves the cursor n lines down relative to the current position. -func Down(n int) { - move(0, n) - if height-n <= 0 { - height = 0 - } else { - height -= n - } +func (c *Cursor) Down(n int) { + c.move(0, n) } // Right moves the cursor n characters to the right relative to the current position. -func Right(n int) { - move(n, 0) +func (c *Cursor) Right(n int) { + c.move(n, 0) } // Left moves the cursor n characters to the left relative to the current position. -func Left(n int) { - move(-n, 0) +func (c *Cursor) Left(n int) { + c.move(-n, 0) } -func move(x int, y int) { - handle := syscall.Handle(target.Fd()) +func (c *Cursor) move(x int, y int) { + handle := syscall.Handle(c.writer.Fd()) var csbi consoleScreenBufferInfo _, _, _ = procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) @@ -54,8 +43,8 @@ func move(x int, y int) { // HorizontalAbsolute moves the cursor to n horizontally. // The position n is absolute to the start of the line. -func HorizontalAbsolute(n int) { - handle := syscall.Handle(target.Fd()) +func (c *Cursor) HorizontalAbsolute(n int) { + handle := syscall.Handle(c.writer.Fd()) var csbi consoleScreenBufferInfo _, _, _ = procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) @@ -74,8 +63,8 @@ func HorizontalAbsolute(n int) { // Show the cursor if it was hidden previously. // Don't forget to show the cursor at least at the end of your application. // Otherwise the user might have a terminal with a permanently hidden cursor, until he reopens the terminal. -func Show() { - handle := syscall.Handle(target.Fd()) +func (c *Cursor) Show() { + handle := syscall.Handle(c.writer.Fd()) var cci consoleCursorInfo _, _, _ = procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&cci))) @@ -87,8 +76,8 @@ func Show() { // Hide the cursor. // Don't forget to show the cursor at least at the end of your application with Show. // Otherwise the user might have a terminal with a permanently hidden cursor, until he reopens the terminal. -func Hide() { - handle := syscall.Handle(target.Fd()) +func (c *Cursor) Hide() { + handle := syscall.Handle(c.writer.Fd()) var cci consoleCursorInfo _, _, _ = procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&cci))) @@ -98,8 +87,8 @@ func Hide() { } // ClearLine clears the current line and moves the cursor to its start position. -func ClearLine() { - handle := syscall.Handle(target.Fd()) +func (c *Cursor) ClearLine() { + handle := syscall.Handle(c.writer.Fd()) var csbi consoleScreenBufferInfo _, _, _ = procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) @@ -110,3 +99,20 @@ func ClearLine() { x = csbi.size.x _, _, _ = procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(x), uintptr(*(*int32)(unsafe.Pointer(&cursor))), uintptr(unsafe.Pointer(&w))) } + +// Clear clears the current position and moves the cursor to the left. +func (c *Cursor) Clear() { + handle := syscall.Handle(c.writer.Fd()) + + var csbi consoleScreenBufferInfo + _, _, _ = procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) + + var w uint32 + cursor := csbi.cursorPosition + _, _, _ = procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(1), uintptr(*(*int32)(unsafe.Pointer(&cursor))), uintptr(unsafe.Pointer(&w))) + + if cursor.x > 0 { + cursor.x-- + } + _, _, _ = procSetConsoleCursorPosition.Call(uintptr(handle), uintptr(*(*int32)(unsafe.Pointer(&cursor)))) +} diff --git a/vendor/atomicgo.dev/cursor/go.work b/vendor/atomicgo.dev/cursor/go.work new file mode 100644 index 00000000..c71ff3ba --- /dev/null +++ b/vendor/atomicgo.dev/cursor/go.work @@ -0,0 +1,10 @@ +go 1.18 + +use . + +// replace git.neotel.at/go/c5rest => /home/rl/work/c5rest +// replace git.neotel.at/go/c5db => /home/rl/work/c5db + +// replace github.com/pterm/pterm => H:/work/github.com/pterm/pterm + +// replace atomicgo.dev/cursor => H:/github.com/atomicgo.dev/cursor diff --git a/vendor/atomicgo.dev/cursor/utils.go b/vendor/atomicgo.dev/cursor/utils.go index 6bf619b7..4b75f09e 100644 --- a/vendor/atomicgo.dev/cursor/utils.go +++ b/vendor/atomicgo.dev/cursor/utils.go @@ -1,17 +1,92 @@ package cursor -import "io" +import ( + "io" + "os" +) -var height int +// +// Helpers for global cursor handling on os.Stdout +// + +var autoheight int +var cursor = &Cursor{writer: os.Stdout} + +// Writer is an expanded io.Writer interface with a file descriptor. +type Writer interface { + io.Writer + Fd() uintptr +} + +// SetTarget sets to output target of the default curser to the +// provided cursor.Writer (wrapping io.Writer). +func SetTarget(w Writer) { + cursor = cursor.WithWriter(w) +} + +// Up moves the cursor n lines up relative to the current position. +func Up(n int) { + cursor.Up(n) + autoheight += n +} + +// Down moves the cursor n lines down relative to the current position. +func Down(n int) { + cursor.Down(n) + + if autoheight > 0 { + autoheight -= n + } +} + +// Right moves the cursor n characters to the right relative to the current position. +func Right(n int) { + cursor.Right(n) +} + +// Left moves the cursor n characters to the left relative to the current position. +func Left(n int) { + cursor.Left(n) +} + +// HorizontalAbsolute moves the cursor to n horizontally. +// The position n is absolute to the start of the line. +func HorizontalAbsolute(n int) { + cursor.HorizontalAbsolute(n) +} + +// Show the cursor if it was hidden previously. +// Don't forget to show the cursor at least at the end of your application. +// Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal. +func Show() { + cursor.Show() +} + +// Hide the cursor. +// Don't forget to show the cursor at least at the end of your application with Show. +// Otherwise the user might have a terminal with a permanently hidden cursor, until they reopen the terminal. +func Hide() { + cursor.Hide() +} + +// ClearLine clears the current line and moves the cursor to it's start position. +func ClearLine() { + cursor.ClearLine() +} + +// Clear clears the current position and moves the cursor to the left. +func Clear() { + cursor.Clear() +} // Bottom moves the cursor to the bottom of the terminal. // This is done by calculating how many lines were moved by Up and Down. func Bottom() { - if height > 0 { - Down(height) + if autoheight > 0 { + Down(autoheight) StartOfLine() - height = 0 + autoheight = 0 } } @@ -74,9 +149,3 @@ func ClearLinesDown(n int) { DownAndClear(1) } } - -// Writer is an expanded io.Writer interface with a file descriptor. -type Writer interface { - io.Writer - Fd() uintptr -} diff --git a/vendor/atomicgo.dev/schedule/.golangci.yml b/vendor/atomicgo.dev/schedule/.golangci.yml index d5a1a2e1..796ca35c 100644 --- a/vendor/atomicgo.dev/schedule/.golangci.yml +++ b/vendor/atomicgo.dev/schedule/.golangci.yml @@ -17,54 +17,83 @@ linters-settings: - ptrToRefParam - paramTypeCombine - unnamedResult - misspell: - locale: US linters: disable-all: true enable: + # default linters - errcheck - gosimple - govet - ineffassign - staticcheck + - typecheck + - unused + # additional linters + - asasalint - asciicheck + - bidichk - bodyclose + - containedctx + - contextcheck + - decorder - dupl - durationcheck + - errchkjson + - errname - errorlint - exhaustive - - gci - - gocognit + - exhaustruct + - exportloopref + - forcetypeassert + - gocheckcompilerdirectives - gocritic - godot - godox - goerr113 - gofmt - - goimports - goprintffuncname - - misspell + - gosec + - gosmopolitan + - importas + - ireturn + - nakedret + - nestif - nilerr - - noctx + - nilnil - prealloc - predeclared + - revive + - rowserrcheck + - tagalign + - tenv - thelper + - tparallel - unconvert - unparam + - usestdlibvars - wastedassign + - whitespace - wrapcheck + - wsl + - gocyclo + - misspell issues: - # Excluding configuration per-path, per-linter, per-text and per-source + include: + - EXC0012 + - EXC0014 exclude-rules: - path: _test\.go linters: + - gocyclo - errcheck - dupl + - gosec - gocritic - - wrapcheck - - goerr113 - # https://github.com/go-critic/go-critic/issues/926 - linters: - gocritic text: "unnecessaryDefer:" + - linters: + - gocritic + text: "preferDecodeRune:" service: - golangci-lint-version: 1.39.x # use the fixed version to not introduce new linters unexpectedly + golangci-lint-version: 1.53.x diff --git a/vendor/atomicgo.dev/schedule/README.md b/vendor/atomicgo.dev/schedule/README.md index ca0b291f..3f7f9a84 100644 --- a/vendor/atomicgo.dev/schedule/README.md +++ b/vendor/atomicgo.dev/schedule/README.md @@ -1,13 +1,14 @@

AtomicGo | schedule

+Downloads Latest Release -Tests +Tests @@ -18,21 +19,19 @@ Unit test count - -Issues - - License: MIT + + +Go report +

---

-Get The Module -| Documentation | Contributing @@ -49,11 +48,6 @@

-
-
- ----------------------------------------------------------------------------------------------------- - -

@@ -61,11 +55,6 @@

-
-
- ----------------------------------------------------------------------------------------------------- - -

@@ -86,19 +75,20 @@ It can run a function at a given time, in a given duration, or repeatedly at a g ## Index -- [type Task](<#type-task>) - - [func After(d time.Duration, task func()) *Task](<#func-after>) - - [func At(t time.Time, task func()) *Task](<#func-at>) - - [func Every(interval time.Duration, task func()) *Task](<#func-every>) - - [func (s *Task) ExecutesIn() time.Duration](<#func-task-executesin>) - - [func (s *Task) IsActive() bool](<#func-task-isactive>) - - [func (s *Task) NextExecutionTime() time.Time](<#func-task-nextexecutiontime>) - - [func (s *Task) StartedAt() time.Time](<#func-task-startedat>) - - [func (s *Task) Stop()](<#func-task-stop>) - - [func (s *Task) Wait()](<#func-task-wait>) +- [type Task](<#Task>) + - [func After\(d time.Duration, task func\(\)\) \*Task](<#After>) + - [func At\(t time.Time, task func\(\)\) \*Task](<#At>) + - [func Every\(interval time.Duration, task func\(\) bool\) \*Task](<#Every>) + - [func \(s \*Task\) ExecutesIn\(\) time.Duration](<#Task.ExecutesIn>) + - [func \(s \*Task\) IsActive\(\) bool](<#Task.IsActive>) + - [func \(s \*Task\) NextExecutionTime\(\) time.Time](<#Task.NextExecutionTime>) + - [func \(s \*Task\) StartedAt\(\) time.Time](<#Task.StartedAt>) + - [func \(s \*Task\) Stop\(\)](<#Task.Stop>) + - [func \(s \*Task\) Wait\(\)](<#Task.Wait>) -## type Task + +## type [Task]() Task holds information about the running task and can be used to stop running tasks. @@ -108,7 +98,8 @@ type Task struct { } ``` -### func After + +### func [After]() ```go func After(d time.Duration, task func()) *Task @@ -119,6 +110,8 @@ After executes the task after the given duration. The function is non\-blocking.
Example

+ + ```go package main @@ -143,7 +136,8 @@ func main() {

-### func At + +### func [At]() ```go func At(t time.Time, task func()) *Task @@ -154,6 +148,8 @@ At executes the task at the given time. The function is non\-blocking. If you wa
Example

+ + ```go package main @@ -178,17 +174,20 @@ func main() {

-### func Every + +### func [Every]() ```go -func Every(interval time.Duration, task func()) *Task +func Every(interval time.Duration, task func() bool) *Task ``` -Every executes the task in the given interval. The function is non\-blocking. If you want to wait for the task to be executed, use the Task.Wait method. +Every executes the task in the given interval, as long as the task function returns true. The function is non\-blocking. If you want to wait for the task to be executed, use the Task.Wait method.
Example

+ + ```go package main @@ -200,8 +199,9 @@ import ( ) func main() { - task := schedule.Every(5*time.Second, func() { - fmt.Println("5 seconds are over!") + task := schedule.Every(time.Second, func() bool { + fmt.Println("1 second is over!") + return true // return false to stop the task }) fmt.Println("Some stuff happening...") @@ -215,7 +215,8 @@ func main() {

-### func \(\*Task\) ExecutesIn + +### func \(\*Task\) [ExecutesIn]() ```go func (s *Task) ExecutesIn() time.Duration @@ -223,7 +224,8 @@ func (s *Task) ExecutesIn() time.Duration ExecutesIn returns the duration until the next execution. -### func \(\*Task\) IsActive + +### func \(\*Task\) [IsActive]() ```go func (s *Task) IsActive() bool @@ -231,7 +233,8 @@ func (s *Task) IsActive() bool IsActive returns true if the scheduler is active. -### func \(\*Task\) NextExecutionTime + +### func \(\*Task\) [NextExecutionTime]() ```go func (s *Task) NextExecutionTime() time.Time @@ -239,7 +242,8 @@ func (s *Task) NextExecutionTime() time.Time NextExecutionTime returns the time when the next execution will happen. -### func \(\*Task\) StartedAt + +### func \(\*Task\) [StartedAt]() ```go func (s *Task) StartedAt() time.Time @@ -247,7 +251,8 @@ func (s *Task) StartedAt() time.Time StartedAt returns the time when the scheduler was started. -### func \(\*Task\) Stop + +### func \(\*Task\) [Stop]() ```go func (s *Task) Stop() @@ -255,7 +260,8 @@ func (s *Task) Stop() Stop stops the scheduler. -### func \(\*Task\) Wait + +### func \(\*Task\) [Wait]() ```go func (s *Task) Wait() @@ -263,8 +269,6 @@ func (s *Task) Wait() Wait blocks until the scheduler is stopped. After and At will stop automatically after the task is executed. - - Generated by [gomarkdoc]() diff --git a/vendor/atomicgo.dev/schedule/schedule.go b/vendor/atomicgo.dev/schedule/schedule.go index 1ab1c839..635d29d3 100644 --- a/vendor/atomicgo.dev/schedule/schedule.go +++ b/vendor/atomicgo.dev/schedule/schedule.go @@ -91,9 +91,9 @@ func At(t time.Time, task func()) *Task { return scheduler } -// Every executes the task in the given interval. +// Every executes the task in the given interval, as long as the task function returns true. // The function is non-blocking. If you want to wait for the task to be executed, use the Task.Wait method. -func Every(interval time.Duration, task func()) *Task { +func Every(interval time.Duration, task func() bool) *Task { scheduler := newTask() scheduler.nextExecution = time.Now().Add(interval) diff --git a/vendor/github.com/gookit/color/color_16.go b/vendor/github.com/gookit/color/color_16.go index 0b70efe4..eda226a1 100644 --- a/vendor/github.com/gookit/color/color_16.go +++ b/vendor/github.com/gookit/color/color_16.go @@ -41,15 +41,27 @@ func (o Opts) String() string { * Basic 16 color definition *************************************************************/ -// Base value for foreground/background color -// base: fg 30~37, bg 40~47 -// light: fg 90~97, bg 100~107 +const ( + // OptMax max option value. range: 0 - 9 + OptMax = 10 + // DiffFgBg diff foreground and background color + DiffFgBg = 10 +) + +// Boundary value for foreground/background color 16 +// +// - base: fg 30~37, bg 40~47 +// - light: fg 90~97, bg 100~107 const ( FgBase uint8 = 30 + FgMax uint8 = 37 BgBase uint8 = 40 + BgMax uint8 = 47 HiFgBase uint8 = 90 + HiFgMax uint8 = 97 HiBgBase uint8 = 100 + HiBgMax uint8 = 107 ) // Foreground colors. basic foreground colors 30 - 37 @@ -94,7 +106,7 @@ const ( BgDefault Color = 49 ) -// Extra background color 100 - 107(非标准) +// Extra background color 100 - 107 (non-standard) const ( BgDarkGray Color = iota + 100 BgLightRed @@ -108,7 +120,7 @@ const ( BgGray Color = 100 ) -// Option settings +// Option settings. range: 0 - 9 const ( OpReset Color = iota // 0 重置所有设置 OpBold // 1 加粗 @@ -248,9 +260,9 @@ func (c Color) Println(a ...any) { doPrintlnV2(c.String(), a) } // lightCyan := Cyan.Light() // lightCyan.Print("message") func (c Color) Light() Color { - val := int(c) + val := uint8(c) if val >= 30 && val <= 47 { - return Color(uint8(c) + 60) + return Color(val + 60) } // don't change @@ -264,9 +276,9 @@ func (c Color) Light() Color { // cyan := LightCyan.Darken() // cyan.Print("message") func (c Color) Darken() Color { - val := int(c) + val := uint8(c) if val >= 90 && val <= 107 { - return Color(uint8(c) - 60) + return Color(val - 60) } // don't change @@ -324,7 +336,7 @@ func (c Color) RGB() RGBColor { return emptyRGBColor } - return HEX(Basic2hex(val)) + return HEX(Basic2hex(val), c.IsBg()) } // Code convert to code string. eg "35" @@ -337,8 +349,23 @@ func (c Color) String() string { return strconv.FormatInt(int64(c), 10) } +// IsBg check is background color +func (c Color) IsBg() bool { + val := uint8(c) + return val >= BgBase && val <= BgMax || val >= HiBgBase && val <= HiBgMax +} + +// IsFg check is foreground color +func (c Color) IsFg() bool { + val := uint8(c) + return val >= FgBase && val <= FgMax || val >= HiFgBase && val <= HiFgMax +} + +// IsOption check is option code: 0-9 +func (c Color) IsOption() bool { return uint8(c) < OptMax } + // IsValid color value -func (c Color) IsValid() bool { return c < 107 } +func (c Color) IsValid() bool { return uint8(c) < HiBgMax } /************************************************************* * basic color maps diff --git a/vendor/github.com/gookit/color/color_256.go b/vendor/github.com/gookit/color/color_256.go index 991e604c..79ae5f8d 100644 --- a/vendor/github.com/gookit/color/color_256.go +++ b/vendor/github.com/gookit/color/color_256.go @@ -43,7 +43,8 @@ const ( * 8bit(256) Color: Bit8Color Color256 *************************************************************/ -// Color256 256 color (8 bit), uint8 range at 0 - 255 +// Color256 256 color (8 bit), uint8 range at 0 - 255. +// Support 256 color on windows CMD, PowerShell // // 颜色值使用10进制和16进制都可 0x98 = 152 // @@ -54,10 +55,9 @@ const ( // // example: // -// fg color: [152, 0] -// bg color: [152, 1] +// fg color: [152, 0] +// bg color: [152, 1] // -// NOTICE: now support 256 color on windows CMD, PowerShell // lint warn - Name starts with package name type Color256 [2]uint8 type Bit8Color = Color256 // alias @@ -164,9 +164,7 @@ func (c Color256) String() string { } // IsFg color -func (c Color256) IsFg() bool { - return c[1] == AsFg -} +func (c Color256) IsFg() bool { return c[1] == AsFg } // ToFg 256 color func (c Color256) ToFg() Color256 { @@ -175,9 +173,7 @@ func (c Color256) ToFg() Color256 { } // IsBg color -func (c Color256) IsBg() bool { - return c[1] == AsBg -} +func (c Color256) IsBg() bool { return c[1] == AsBg } // ToBg 256 color func (c Color256) ToBg() Color256 { @@ -186,9 +182,7 @@ func (c Color256) ToBg() Color256 { } // IsEmpty value -func (c Color256) IsEmpty() bool { - return c[1] > 1 -} +func (c Color256) IsEmpty() bool { return c[1] > 1 } /************************************************************* * 8bit(256) Style diff --git a/vendor/github.com/gookit/color/color_rgb.go b/vendor/github.com/gookit/color/color_rgb.go index 724cf665..bc129b71 100644 --- a/vendor/github.com/gookit/color/color_rgb.go +++ b/vendor/github.com/gookit/color/color_rgb.go @@ -44,6 +44,7 @@ const ( *************************************************************/ // RGBColor definition. +// Support RGB color on Windows CMD, PowerShell // // The first to third digits represent the color value. // The last digit represents the foreground(0), background(1), >1 is unset value @@ -54,8 +55,6 @@ const ( // // 3rd: Fg=0, Bg=1, >1: unset value // RGBColor{30,144,255, 0} // RGBColor{30,144,255, 1} -// -// NOTICE: now support RGB color on Windows CMD, PowerShell type RGBColor [4]uint8 // create an empty RGBColor @@ -251,6 +250,18 @@ func (c RGBColor) String() string { return "" } +// ToBg convert to background color +func (c RGBColor) ToBg() RGBColor { + c[3] = AsBg + return c +} + +// ToFg convert to foreground color +func (c RGBColor) ToFg() RGBColor { + c[3] = AsFg + return c +} + // IsEmpty value func (c RGBColor) IsEmpty() bool { return c[3] > AsBg diff --git a/vendor/github.com/gookit/color/convert.go b/vendor/github.com/gookit/color/convert.go index 39aac7d2..c7103536 100644 --- a/vendor/github.com/gookit/color/convert.go +++ b/vendor/github.com/gookit/color/convert.go @@ -52,6 +52,7 @@ var ( // ---------- basic(16) <=> RGB color convert ---------- // refer from Hyper app + // Tip: only keep foreground color, background color need convert to foreground color for convert to RGB basic2hexMap = map[uint8]string{ 30: "000000", // black 31: "c51e14", // red @@ -61,7 +62,7 @@ var ( 35: "c839c5", // magenta 36: "20c5c6", // cyan 37: "c7c7c7", // white - // - don't add bg color + // - don't add bg color, convert to fg color for convert to RGB // 40: "000000", // black // 41: "c51e14", // red // 42: "1dc121", // green @@ -428,10 +429,11 @@ func HexToRGB(hex string) []int { return HexToRgb(hex) } // HexToRgb convert hex color string to RGB numbers // // Usage: -// rgb := HexToRgb("ccc") // rgb: [204 204 204] -// rgb := HexToRgb("aabbcc") // rgb: [170 187 204] -// rgb := HexToRgb("#aabbcc") // rgb: [170 187 204] -// rgb := HexToRgb("0xad99c0") // rgb: [170 187 204] +// +// rgb := HexToRgb("ccc") // rgb: [204 204 204] +// rgb := HexToRgb("aabbcc") // rgb: [170 187 204] +// rgb := HexToRgb("#aabbcc") // rgb: [170 187 204] +// rgb := HexToRgb("0xad99c0") // rgb: [170 187 204] func HexToRgb(hex string) (rgb []int) { hex = strings.TrimSpace(hex) if hex == "" { @@ -474,6 +476,7 @@ func Rgb2hex(rgb []int) string { return RgbToHex(rgb) } // RgbToHex convert RGB-code to hex-code // // Usage: +// // hex := RgbToHex([]int{170, 187, 204}) // hex: "aabbcc" func RgbToHex(rgb []int) string { hexNodes := make([]string, len(rgb)) @@ -488,10 +491,15 @@ func RgbToHex(rgb []int) string { * 4bit(16) color <=> RGB/True color *************************************************************/ +// BasicToHex convert basic color to hex string. +func BasicToHex(val uint8) string { + val = Bg2Fg(val) + return basic2hexMap[val] +} + // Basic2hex convert basic color to hex string. func Basic2hex(val uint8) string { - val = Fg2Bg(val) - return basic2hexMap[val] + return BasicToHex(val) } // Hex2basic convert hex string to basic color code. @@ -663,6 +671,7 @@ func C256ToRgbV1(val uint8) (rgb []uint8) { // returns r, g, and b in the set [0, 255]. // // Usage: +// // HslIntToRgb(0, 100, 50) // red // HslIntToRgb(120, 100, 50) // lime // HslIntToRgb(120, 100, 25) // dark green @@ -677,6 +686,7 @@ func HslIntToRgb(h, s, l int) (rgb []uint8) { // returns r, g, and b in the set [0, 255]. // // Usage: +// // rgbVals := HslToRgb(0, 1, 0.5) // red func HslToRgb(h, s, l float64) (rgb []uint8) { var r, g, b float64 diff --git a/vendor/github.com/gookit/color/style.go b/vendor/github.com/gookit/color/style.go index a009d1d6..353d39f1 100644 --- a/vendor/github.com/gookit/color/style.go +++ b/vendor/github.com/gookit/color/style.go @@ -37,7 +37,8 @@ func (s *Style) Add(cs ...Color) { *s = append(*s, cs...) } -// Render render text +// Render colored text +// // Usage: // // color.New(color.FgGreen).Render("text") @@ -46,8 +47,9 @@ func (s Style) Render(a ...any) string { return RenderCode(s.String(), a...) } -// Renderln render text line. +// Renderln render text with newline. // like Println, will add spaces for each argument +// // Usage: // // color.New(color.FgGreen).Renderln("text", "more") diff --git a/vendor/github.com/pterm/pterm/CHANGELOG.md b/vendor/github.com/pterm/pterm/CHANGELOG.md index 682dc7b3..2d23495e 100644 --- a/vendor/github.com/pterm/pterm/CHANGELOG.md +++ b/vendor/github.com/pterm/pterm/CHANGELOG.md @@ -1,6 +1,19 @@ ## [Unreleased] +### Bug Fixes +- buggy basic text input ([#551](https://github.com/pterm/pterm/issues/551)) +- **textinput:** fixed buggy behavior ([#550](https://github.com/pterm/pterm/issues/550)) + + + +## [v0.12.64] - 2023-08-03 +### Features +- add custom delimiters to select printers ([#545](https://github.com/pterm/pterm/issues/545)) + + + +## [v0.12.63] - 2023-07-18 ### Features - add filter option for `select` @@ -1198,7 +1211,9 @@ removed `Header` and put it's content directly into `HeaderPrinter` - initial commit -[Unreleased]: https://github.com/pterm/pterm/compare/v0.12.62...HEAD +[Unreleased]: https://github.com/pterm/pterm/compare/v0.12.64...HEAD +[v0.12.64]: https://github.com/pterm/pterm/compare/v0.12.63...v0.12.64 +[v0.12.63]: https://github.com/pterm/pterm/compare/v0.12.62...v0.12.63 [v0.12.62]: https://github.com/pterm/pterm/compare/v0.12.61...v0.12.62 [v0.12.61]: https://github.com/pterm/pterm/compare/v0.12.60...v0.12.61 [v0.12.60]: https://github.com/pterm/pterm/compare/v0.12.59...v0.12.60 diff --git a/vendor/github.com/pterm/pterm/README.md b/vendor/github.com/pterm/pterm/README.md index b874ef12..2648375b 100644 --- a/vendor/github.com/pterm/pterm/README.md +++ b/vendor/github.com/pterm/pterm/README.md @@ -98,9 +98,9 @@ go get github.com/pterm/pterm | Area
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/area) |Barchart
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/barchart) |Basictext
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/basictext) |Bigtext
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/bigtext) |Box
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/box) | | Bulletlist
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/bulletlist) |Center
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/center) |Coloring
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/coloring) |Demo
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/demo) |Header
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/header) | | Interactive confirm
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/interactive_confirm) |Interactive continue
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/interactive_continue) |Interactive multiselect
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/interactive_multiselect) |Interactive select
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/interactive_select) |Interactive textinput
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/interactive_textinput) | -| Logger
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/logger) |Panel
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/panel) |Paragraph
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/paragraph) |Prefix
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/prefix) |Progressbar
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/progressbar) | -| Section
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/section) |Spinner
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/spinner) |Style
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/style) |Table
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/table) |Theme
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/theme) | -| Tree
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/tree) | | | | | +| Logger
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/logger) |Multiple-live-printers
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/multiple-live-printers) |Panel
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/panel) |Paragraph
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/paragraph) |Prefix
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/prefix) | +| Progressbar
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/progressbar) |Section
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/section) |Spinner
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/spinner) |Style
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/style) |Table
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/table) | +| Theme
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/theme) |Tree
[(Examples)](https://github.com/pterm/pterm/tree/master/_examples/tree) | | | | @@ -2127,6 +2127,73 @@ func main() { +### multiple-live-printers/demo + +![Animation](https://raw.githubusercontent.com/pterm/pterm/master/_examples/multiple-live-printers/demo/animation.svg) + +
+ +SHOW SOURCE + +```go +package main + +import ( + "github.com/pterm/pterm" + "time" +) + +func main() { + multi := pterm.DefaultMultiPrinter + + spinner1, _ := pterm.DefaultSpinner.WithWriter(multi.NewWriter()).Start("Spinner 1") + spinner2, _ := pterm.DefaultSpinner.WithWriter(multi.NewWriter()).Start("Spinner 2") + pb1, _ := pterm.DefaultProgressbar.WithTotal(100).WithWriter(multi.NewWriter()).Start("Progressbar 1") + pb2, _ := pterm.DefaultProgressbar.WithTotal(100).WithWriter(multi.NewWriter()).Start("Progressbar 2") + pb3, _ := pterm.DefaultProgressbar.WithTotal(100).WithWriter(multi.NewWriter()).Start("Progressbar 3") + pb4, _ := pterm.DefaultProgressbar.WithTotal(100).WithWriter(multi.NewWriter()).Start("Progressbar 4") + pb5, _ := pterm.DefaultProgressbar.WithTotal(100).WithWriter(multi.NewWriter()).Start("Progressbar 5") + + multi.Start() + + // Randomly increment progress bars for demo purposes. + for i := 1; i <= 100; i++ { + pb1.Increment() + + if i%2 == 0 { + pb2.Add(3) + } + + if i%5 == 0 { + pb3.Increment() + } + + if i%10 == 0 { + pb4.Increment() + } + + if i%3 == 0 { + pb5.Increment() + } + + if i%50 == 0 { + spinner1.Success("Spinner 1 is done!") + } + + if i%60 == 0 { + spinner2.Fail("Spinner 2 failed!") + } + + time.Sleep(time.Millisecond * 50) + } + + multi.Stop() +} + +``` + +
+ ### panel/demo ![Animation](https://raw.githubusercontent.com/pterm/pterm/master/_examples/panel/demo/animation.svg) @@ -2289,6 +2356,63 @@ func main() { +### progressbar/multiple + +![Animation](https://raw.githubusercontent.com/pterm/pterm/master/_examples/progressbar/multiple/animation.svg) + +
+ +SHOW SOURCE + +```go +package main + +import ( + "github.com/pterm/pterm" + "time" +) + +func main() { + multi := pterm.DefaultMultiPrinter + + pb1, _ := pterm.DefaultProgressbar.WithTotal(100).WithWriter(multi.NewWriter()).Start("Progressbar 1") + pb2, _ := pterm.DefaultProgressbar.WithTotal(100).WithWriter(multi.NewWriter()).Start("Progressbar 2") + pb3, _ := pterm.DefaultProgressbar.WithTotal(100).WithWriter(multi.NewWriter()).Start("Progressbar 3") + pb4, _ := pterm.DefaultProgressbar.WithTotal(100).WithWriter(multi.NewWriter()).Start("Progressbar 4") + pb5, _ := pterm.DefaultProgressbar.WithTotal(100).WithWriter(multi.NewWriter()).Start("Progressbar 5") + + multi.Start() + + // Randomly increment progress bars for demo purposes. + for i := 1; i <= 100; i++ { + pb1.Increment() + + if i%2 == 0 { + pb2.Add(3) + } + + if i%5 == 0 { + pb3.Increment() + } + + if i%10 == 0 { + pb4.Increment() + } + + if i%3 == 0 { + pb5.Increment() + } + + time.Sleep(time.Millisecond * 50) + } + + multi.Stop() +} + +``` + +
+ ### section/demo ![Animation](https://raw.githubusercontent.com/pterm/pterm/master/_examples/section/demo/animation.svg) @@ -2383,6 +2507,45 @@ func main() { +### spinner/multiple + +![Animation](https://raw.githubusercontent.com/pterm/pterm/master/_examples/spinner/multiple/animation.svg) + +
+ +SHOW SOURCE + +```go +package main + +import ( + "github.com/pterm/pterm" + "time" +) + +func main() { + multi := pterm.DefaultMultiPrinter + + spinner1, _ := pterm.DefaultSpinner.WithWriter(multi.NewWriter()).Start("Spinner 1") + spinner2, _ := pterm.DefaultSpinner.WithWriter(multi.NewWriter()).Start("Spinner 2") + spinner3, _ := pterm.DefaultSpinner.WithWriter(multi.NewWriter()).Start("Spinner 3") + + multi.Start() + + time.Sleep(time.Millisecond * 1000) + spinner1.Success("Spinner 1 is done!") + time.Sleep(time.Millisecond * 750) + spinner2.Fail("Spinner 2 failed!") + time.Sleep(time.Millisecond * 500) + spinner3.Warning("Spinner 3 has a warning!") + + multi.Stop() +} + +``` + +
+ ### style/demo ![Animation](https://raw.githubusercontent.com/pterm/pterm/master/_examples/style/demo/animation.svg) diff --git a/vendor/github.com/pterm/pterm/area_printer.go b/vendor/github.com/pterm/pterm/area_printer.go index 5f3e5b04..ed4b0c22 100644 --- a/vendor/github.com/pterm/pterm/area_printer.go +++ b/vendor/github.com/pterm/pterm/area_printer.go @@ -1,6 +1,7 @@ package pterm import ( + "io" "strings" "atomicgo.dev/cursor" @@ -47,6 +48,11 @@ func (p AreaPrinter) WithCenter(b ...bool) *AreaPrinter { return &p } +// SetWriter sets the writer for the AreaPrinter. +func (p *AreaPrinter) SetWriter(writer io.Writer) { + +} + // Update overwrites the content of the AreaPrinter. // Can be used live. func (p *AreaPrinter) Update(text ...interface{}) { diff --git a/vendor/github.com/pterm/pterm/interactive_confirm_printer.go b/vendor/github.com/pterm/pterm/interactive_confirm_printer.go index c5065919..a94cc5dc 100644 --- a/vendor/github.com/pterm/pterm/interactive_confirm_printer.go +++ b/vendor/github.com/pterm/pterm/interactive_confirm_printer.go @@ -7,29 +7,30 @@ import ( "atomicgo.dev/cursor" "atomicgo.dev/keyboard" "atomicgo.dev/keyboard/keys" + "github.com/pterm/pterm/internal" ) -var ( - // DefaultInteractiveConfirm is the default InteractiveConfirm printer. - // Pressing "y" will return true, "n" will return false. - // Pressing enter without typing "y" or "n" will return the configured default value (by default set to "no"). - DefaultInteractiveConfirm = InteractiveConfirmPrinter{ - DefaultValue: false, - DefaultText: "Please confirm", - TextStyle: &ThemeDefault.PrimaryStyle, - ConfirmText: "Yes", - ConfirmStyle: &ThemeDefault.SuccessMessageStyle, - RejectText: "No", - RejectStyle: &ThemeDefault.ErrorMessageStyle, - SuffixStyle: &ThemeDefault.SecondaryStyle, - } -) +// DefaultInteractiveConfirm is the default InteractiveConfirm printer. +// Pressing "y" will return true, "n" will return false. +// Pressing enter without typing "y" or "n" will return the configured default value (by default set to "no"). +var DefaultInteractiveConfirm = InteractiveConfirmPrinter{ + DefaultValue: false, + DefaultText: "Please confirm", + TextStyle: &ThemeDefault.PrimaryStyle, + ConfirmText: "Yes", + ConfirmStyle: &ThemeDefault.SuccessMessageStyle, + RejectText: "No", + RejectStyle: &ThemeDefault.ErrorMessageStyle, + SuffixStyle: &ThemeDefault.SecondaryStyle, + Delimiter: ": ", +} // InteractiveConfirmPrinter is a printer for interactive confirm prompts. type InteractiveConfirmPrinter struct { DefaultValue bool DefaultText string + Delimiter string TextStyle *Style ConfirmText string ConfirmStyle *Style @@ -93,6 +94,12 @@ func (p InteractiveConfirmPrinter) WithOnInterruptFunc(exitFunc func()) *Interac return &p } +// WithDelimiter sets the delimiter between the message and the input. +func (p InteractiveConfirmPrinter) WithDelimiter(delimiter string) *InteractiveConfirmPrinter { + p.Delimiter = delimiter + return &p +} + // Show shows the confirm prompt. // // Example: @@ -111,7 +118,7 @@ func (p InteractiveConfirmPrinter) Show(text ...string) (bool, error) { text = []string{p.DefaultText} } - p.TextStyle.Print(text[0] + " " + p.getSuffix() + ": ") + p.TextStyle.Print(text[0] + " " + p.getSuffix() + p.Delimiter) y, n := p.getShortHandles() var interrupted bool diff --git a/vendor/github.com/pterm/pterm/interactive_continue_printer.go b/vendor/github.com/pterm/pterm/interactive_continue_printer.go index d0f91f13..f7e49e8a 100644 --- a/vendor/github.com/pterm/pterm/interactive_continue_printer.go +++ b/vendor/github.com/pterm/pterm/interactive_continue_printer.go @@ -14,24 +14,24 @@ import ( "github.com/pterm/pterm/internal" ) -var ( - // DefaultInteractiveContinue is the default InteractiveContinue printer. - // Pressing "y" will return yes, "n" will return no, "a" returns all and "s" returns stop. - // Pressing enter without typing any letter will return the configured default value (by default set to "yes", the fisrt option). - DefaultInteractiveContinue = InteractiveContinuePrinter{ - DefaultValueIndex: 0, - DefaultText: "Do you want to continue", - TextStyle: &ThemeDefault.PrimaryStyle, - Options: []string{"yes", "no", "all", "cancel"}, - OptionsStyle: &ThemeDefault.SuccessMessageStyle, - SuffixStyle: &ThemeDefault.SecondaryStyle, - } -) +// DefaultInteractiveContinue is the default InteractiveContinue printer. +// Pressing "y" will return yes, "n" will return no, "a" returns all and "s" returns stop. +// Pressing enter without typing any letter will return the configured default value (by default set to "yes", the fisrt option). +var DefaultInteractiveContinue = InteractiveContinuePrinter{ + DefaultValueIndex: 0, + DefaultText: "Do you want to continue", + TextStyle: &ThemeDefault.PrimaryStyle, + Options: []string{"yes", "no", "all", "cancel"}, + OptionsStyle: &ThemeDefault.SuccessMessageStyle, + SuffixStyle: &ThemeDefault.SecondaryStyle, + Delimiter: ": ", +} // InteractiveContinuePrinter is a printer for interactive continue prompts. type InteractiveContinuePrinter struct { DefaultValueIndex int DefaultText string + Delimiter string TextStyle *Style Options []string OptionsStyle *Style @@ -108,6 +108,12 @@ func (p InteractiveContinuePrinter) WithSuffixStyle(style *Style) *InteractiveCo return &p } +// WithDelimiter sets the delimiter between the message and the input. +func (p InteractiveContinuePrinter) WithDelimiter(delimiter string) *InteractiveContinuePrinter { + p.Delimiter = delimiter + return &p +} + // Show shows the continue prompt. // // Example: @@ -121,7 +127,7 @@ func (p InteractiveContinuePrinter) Show(text ...string) (string, error) { text = []string{p.DefaultText} } - p.TextStyle.Print(text[0] + " " + p.getSuffix() + ": ") + p.TextStyle.Print(text[0] + " " + p.getSuffix() + p.Delimiter) err := keyboard.Listen(func(keyInfo keys.Key) (stop bool, err error) { if err != nil { diff --git a/vendor/github.com/pterm/pterm/interactive_textinput_printer.go b/vendor/github.com/pterm/pterm/interactive_textinput_printer.go index 111788ae..2514ab12 100644 --- a/vendor/github.com/pterm/pterm/interactive_textinput_printer.go +++ b/vendor/github.com/pterm/pterm/interactive_textinput_printer.go @@ -10,19 +10,19 @@ import ( "github.com/pterm/pterm/internal" ) -var ( - // DefaultInteractiveTextInput is the default InteractiveTextInput printer. - DefaultInteractiveTextInput = InteractiveTextInputPrinter{ - DefaultText: "Input text", - TextStyle: &ThemeDefault.PrimaryStyle, - Mask: "", - } -) +// DefaultInteractiveTextInput is the default InteractiveTextInput printer. +var DefaultInteractiveTextInput = InteractiveTextInputPrinter{ + DefaultText: "Input text", + Delimiter: ": ", + TextStyle: &ThemeDefault.PrimaryStyle, + Mask: "", +} // InteractiveTextInputPrinter is a printer for interactive select menus. type InteractiveTextInputPrinter struct { TextStyle *Style DefaultText string + Delimiter string MultiLine bool Mask string OnInterruptFunc func() @@ -57,12 +57,18 @@ func (p InteractiveTextInputPrinter) WithMask(mask string) *InteractiveTextInput return &p } -// OnInterrupt sets the function to execute on exit of the input reader +// WithOnInterruptFunc sets the function to execute on exit of the input reader func (p InteractiveTextInputPrinter) WithOnInterruptFunc(exitFunc func()) *InteractiveTextInputPrinter { p.OnInterruptFunc = exitFunc return &p } +// WithDelimiter sets the delimiter between the message and the input. +func (p InteractiveTextInputPrinter) WithDelimiter(delimiter string) *InteractiveTextInputPrinter { + p.Delimiter = delimiter + return &p +} + // Show shows the interactive select menu and returns the selected entry. func (p InteractiveTextInputPrinter) Show(text ...string) (string, error) { // should be the first defer statement to make sure it is executed last @@ -77,24 +83,20 @@ func (p InteractiveTextInputPrinter) Show(text ...string) (string, error) { } if p.MultiLine { - areaText = p.TextStyle.Sprintfln("%s %s :", text[0], ThemeDefault.SecondaryStyle.Sprint("[Press tab to submit]")) + areaText = p.TextStyle.Sprintfln("%s %s %s", text[0], ThemeDefault.SecondaryStyle.Sprint("[Press tab to submit]"), p.Delimiter) } else { - areaText = p.TextStyle.Sprintf("%s: ", text[0]) + areaText = p.TextStyle.Sprintf("%s%s", text[0], p.Delimiter) } p.text = areaText - area, err := DefaultArea.Start(areaText) - defer area.Stop() - if err != nil { - return "", err - } + area := cursor.NewArea() + area.Update(areaText) + area.StartOfLine() - cursor.Up(1) - cursor.StartOfLine() if !p.MultiLine { cursor.Right(len(RemoveColorFromString(areaText))) } - err = keyboard.Listen(func(key keys.Key) (stop bool, err error) { + err := keyboard.Listen(func(key keys.Key) (stop bool, err error) { if !p.MultiLine { p.cursorYPos = 0 } @@ -105,6 +107,7 @@ func (p InteractiveTextInputPrinter) Show(text ...string) (string, error) { switch key.Code { case keys.Tab: if p.MultiLine { + area.Bottom() return true, nil } case keys.Enter: @@ -119,7 +122,6 @@ func (p InteractiveTextInputPrinter) Show(text ...string) (string, error) { p.input = append(p.input, appendAfterY...) p.cursorYPos++ p.cursorXPos = -internal.GetStringMaxWidth(p.input[p.cursorYPos]) - cursor.Down(1) cursor.StartOfLine() } else { return true, nil @@ -188,7 +190,7 @@ func (p InteractiveTextInputPrinter) Show(text ...string) (string, error) { } } - p.updateArea(area) + p.updateArea(&area) return false, nil }) @@ -210,7 +212,7 @@ func (p InteractiveTextInputPrinter) Show(text ...string) (string, error) { return strings.ReplaceAll(areaText, p.text, ""), nil } -func (p InteractiveTextInputPrinter) updateArea(area *AreaPrinter) string { +func (p InteractiveTextInputPrinter) updateArea(area *cursor.Area) string { if !p.MultiLine { p.cursorYPos = 0 } @@ -232,10 +234,10 @@ func (p InteractiveTextInputPrinter) updateArea(area *AreaPrinter) string { p.cursorXPos = -internal.GetStringMaxWidth(p.input[p.cursorYPos]) } - cursor.StartOfLine() area.Update(areaText) - cursor.Up(len(p.input) - p.cursorYPos) - cursor.StartOfLine() + area.Top() + area.Down(p.cursorYPos + 1) + area.StartOfLine() if p.MultiLine { cursor.Right(internal.GetStringMaxWidth(p.input[p.cursorYPos]) + p.cursorXPos) } else { diff --git a/vendor/github.com/pterm/pterm/interface_live_printer.go b/vendor/github.com/pterm/pterm/interface_live_printer.go index b8d3dbe3..69dce345 100644 --- a/vendor/github.com/pterm/pterm/interface_live_printer.go +++ b/vendor/github.com/pterm/pterm/interface_live_printer.go @@ -1,5 +1,7 @@ package pterm +import "io" + // LivePrinter is a printer which can update it's output live. type LivePrinter interface { // GenericStart runs Start, but returns a LivePrinter. @@ -11,4 +13,6 @@ type LivePrinter interface { // This is used for the interface LivePrinter. // You most likely want to use Stop instead of this in your program. GenericStop() (*LivePrinter, error) + + SetWriter(writer io.Writer) } diff --git a/vendor/github.com/pterm/pterm/multi_live_printer.go b/vendor/github.com/pterm/pterm/multi_live_printer.go new file mode 100644 index 00000000..b9e0d0e8 --- /dev/null +++ b/vendor/github.com/pterm/pterm/multi_live_printer.go @@ -0,0 +1,124 @@ +package pterm + +import ( + "atomicgo.dev/schedule" + "bytes" + "io" + "os" + "strings" + "time" +) + +var DefaultMultiPrinter = MultiPrinter{ + printers: []LivePrinter{}, + Writer: os.Stdout, + UpdateDelay: time.Millisecond * 200, + + buffers: []*bytes.Buffer{}, + area: DefaultArea, +} + +type MultiPrinter struct { + IsActive bool + Writer io.Writer + UpdateDelay time.Duration + + printers []LivePrinter + buffers []*bytes.Buffer + area AreaPrinter +} + +// SetWriter sets the writer for the AreaPrinter. +func (p *MultiPrinter) SetWriter(writer io.Writer) { + p.Writer = writer +} + +// WithWriter returns a fork of the MultiPrinter with a new writer. +func (p MultiPrinter) WithWriter(writer io.Writer) *MultiPrinter { + p.Writer = writer + return &p +} + +// WithUpdateDelay returns a fork of the MultiPrinter with a new update delay. +func (p MultiPrinter) WithUpdateDelay(delay time.Duration) *MultiPrinter { + p.UpdateDelay = delay + return &p +} + +func (p *MultiPrinter) NewWriter() io.Writer { + buf := bytes.NewBufferString("") + p.buffers = append(p.buffers, buf) + return buf +} + +// getString returns all buffers appended and separated by a newline. +func (p *MultiPrinter) getString() string { + var buffer bytes.Buffer + for _, b := range p.buffers { + s := b.String() + s = strings.Trim(s, "\n") + + parts := strings.Split(s, "\r") // only get the last override + s = parts[len(parts)-1] + + // check if s is empty, if so get one part before, repeat until not empty + for s == "" { + parts = parts[:len(parts)-1] + s = parts[len(parts)-1] + } + + s = strings.Trim(s, "\n\r") + buffer.WriteString(s) + buffer.WriteString("\n") + } + return buffer.String() +} + +func (p *MultiPrinter) Start() (*MultiPrinter, error) { + p.IsActive = true + for _, printer := range p.printers { + printer.GenericStart() + } + + schedule.Every(p.UpdateDelay, func() bool { + if !p.IsActive { + return false + } + + p.area.Update(p.getString()) + + return true + }) + + return p, nil +} + +func (p *MultiPrinter) Stop() (*MultiPrinter, error) { + p.IsActive = false + for _, printer := range p.printers { + printer.GenericStop() + } + time.Sleep(time.Millisecond * 20) + p.area.Update(p.getString()) + p.area.Stop() + + return p, nil +} + +// GenericStart runs Start, but returns a LivePrinter. +// This is used for the interface LivePrinter. +// You most likely want to use Start instead of this in your program. +func (p MultiPrinter) GenericStart() (*LivePrinter, error) { + p2, _ := p.Start() + lp := LivePrinter(p2) + return &lp, nil +} + +// GenericStop runs Stop, but returns a LivePrinter. +// This is used for the interface LivePrinter. +// You most likely want to use Stop instead of this in your program. +func (p MultiPrinter) GenericStop() (*LivePrinter, error) { + p2, _ := p.Stop() + lp := LivePrinter(p2) + return &lp, nil +} diff --git a/vendor/github.com/pterm/pterm/progressbar_printer.go b/vendor/github.com/pterm/pterm/progressbar_printer.go index 282adcda..1cf4a0c2 100644 --- a/vendor/github.com/pterm/pterm/progressbar_printer.go +++ b/vendor/github.com/pterm/pterm/progressbar_printer.go @@ -18,23 +18,21 @@ import ( // Generally, there should only be one active ProgressbarPrinter at a time. var ActiveProgressBarPrinters []*ProgressbarPrinter -var ( - // DefaultProgressbar is the default ProgressbarPrinter. - DefaultProgressbar = ProgressbarPrinter{ - Total: 100, - BarCharacter: "█", - LastCharacter: "█", - ElapsedTimeRoundingFactor: time.Second, - BarStyle: &ThemeDefault.ProgressbarBarStyle, - TitleStyle: &ThemeDefault.ProgressbarTitleStyle, - ShowTitle: true, - ShowCount: true, - ShowPercentage: true, - ShowElapsedTime: true, - BarFiller: Gray("█"), - MaxWidth: 80, - } -) +// DefaultProgressbar is the default ProgressbarPrinter. +var DefaultProgressbar = ProgressbarPrinter{ + Total: 100, + BarCharacter: "█", + LastCharacter: "█", + ElapsedTimeRoundingFactor: time.Second, + BarStyle: &ThemeDefault.ProgressbarBarStyle, + TitleStyle: &ThemeDefault.ProgressbarTitleStyle, + ShowTitle: true, + ShowCount: true, + ShowPercentage: true, + ShowElapsedTime: true, + BarFiller: Gray("█"), + MaxWidth: 80, +} // ProgressbarPrinter shows a progress animation in the terminal. type ProgressbarPrinter struct { @@ -162,6 +160,11 @@ func (p ProgressbarPrinter) WithWriter(writer io.Writer) *ProgressbarPrinter { return &p } +// SetWriter sets the custom Writer. +func (p *ProgressbarPrinter) SetWriter(writer io.Writer) { + p.Writer = writer +} + // Increment current value by one. func (p *ProgressbarPrinter) Increment() *ProgressbarPrinter { p.Add(1) @@ -177,8 +180,13 @@ func (p *ProgressbarPrinter) UpdateTitle(title string) *ProgressbarPrinter { // This is the update logic, renders the progressbar func (p *ProgressbarPrinter) updateProgress() *ProgressbarPrinter { + Fprinto(p.Writer, p.getString()) + return p +} + +func (p *ProgressbarPrinter) getString() string { if !p.IsActive { - return p + return "" } if p.TitleStyle == nil { p.TitleStyle = NewStyle() @@ -187,7 +195,7 @@ func (p *ProgressbarPrinter) updateProgress() *ProgressbarPrinter { p.BarStyle = NewStyle() } if p.Total == 0 { - return nil + return "" } var before string @@ -235,10 +243,7 @@ func (p *ProgressbarPrinter) updateProgress() *ProgressbarPrinter { bar = p.BarStyle.Sprint(strings.Repeat(p.BarCharacter, barCurrentLength)+p.LastCharacter) + bar } - if !RawOutput { - Fprinto(p.Writer, before+bar+after) - } - return p + return before + bar + after } // Add to current value. @@ -251,6 +256,8 @@ func (p *ProgressbarPrinter) Add(count int) *ProgressbarPrinter { p.updateProgress() if p.Current >= p.Total { + p.Total = p.Current + p.updateProgress() p.Stop() } return p @@ -272,8 +279,9 @@ func (p ProgressbarPrinter) Start(title ...interface{}) (*ProgressbarPrinter, er p.updateProgress() if p.ShowElapsedTime { - p.rerenderTask = schedule.Every(time.Second, func() { + p.rerenderTask = schedule.Every(time.Second, func() bool { p.updateProgress() + return true }) } @@ -303,7 +311,7 @@ func (p *ProgressbarPrinter) Stop() (*ProgressbarPrinter, error) { // GenericStart runs Start, but returns a LivePrinter. // This is used for the interface LivePrinter. // You most likely want to use Start instead of this in your program. -func (p ProgressbarPrinter) GenericStart() (*LivePrinter, error) { +func (p *ProgressbarPrinter) GenericStart() (*LivePrinter, error) { p2, _ := p.Start() lp := LivePrinter(p2) return &lp, nil @@ -312,7 +320,7 @@ func (p ProgressbarPrinter) GenericStart() (*LivePrinter, error) { // GenericStop runs Stop, but returns a LivePrinter. // This is used for the interface LivePrinter. // You most likely want to use Stop instead of this in your program. -func (p ProgressbarPrinter) GenericStop() (*LivePrinter, error) { +func (p *ProgressbarPrinter) GenericStop() (*LivePrinter, error) { p2, _ := p.Stop() lp := LivePrinter(p2) return &lp, nil diff --git a/vendor/github.com/pterm/pterm/spinner_printer.go b/vendor/github.com/pterm/pterm/spinner_printer.go index 82b84af7..044b6976 100644 --- a/vendor/github.com/pterm/pterm/spinner_printer.go +++ b/vendor/github.com/pterm/pterm/spinner_printer.go @@ -110,15 +110,18 @@ func (p SpinnerPrinter) WithWriter(writer io.Writer) *SpinnerPrinter { return &p } +// SetWriter sets the custom Writer. +func (p *SpinnerPrinter) SetWriter(writer io.Writer) { + p.Writer = writer +} + // UpdateText updates the message of the active SpinnerPrinter. // Can be used live. func (s *SpinnerPrinter) UpdateText(text string) { s.Text = text if !RawOutput { - fClearLine(s.Writer) Fprinto(s.Writer, s.Style.Sprint(s.currentSequence)+" "+s.MessageStyle.Sprint(s.Text)) - } - if RawOutput { + } else { Fprintln(s.Writer, s.Text) } } @@ -152,7 +155,6 @@ func (s SpinnerPrinter) Start(text ...interface{}) (*SpinnerPrinter, error) { if s.ShowTimer { timer = " (" + time.Since(s.startedAt).Round(s.TimerRoundingFactor).String() + ")" } - fClearLine(s.Writer) Fprinto(s.Writer, s.Style.Sprint(seq)+" "+s.MessageStyle.Sprint(s.Text)+s.TimerStyle.Sprint(timer)) s.currentSequence = seq time.Sleep(s.Delay) @@ -182,8 +184,8 @@ func (s *SpinnerPrinter) Stop() error { // This is used for the interface LivePrinter. // You most likely want to use Start instead of this in your program. func (s *SpinnerPrinter) GenericStart() (*LivePrinter, error) { - _, _ = s.Start() - lp := LivePrinter(s) + p2, _ := s.Start() + lp := LivePrinter(p2) return &lp, nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 6c48a067..47d4b15f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# atomicgo.dev/cursor v0.1.3 +# atomicgo.dev/cursor v0.2.0 ## explicit; go 1.15 atomicgo.dev/cursor # atomicgo.dev/keyboard v0.2.9 @@ -6,7 +6,7 @@ atomicgo.dev/cursor atomicgo.dev/keyboard atomicgo.dev/keyboard/internal atomicgo.dev/keyboard/keys -# atomicgo.dev/schedule v0.0.2 +# atomicgo.dev/schedule v0.1.0 ## explicit; go 1.18 atomicgo.dev/schedule # dario.cat/mergo v1.0.0 @@ -168,7 +168,7 @@ github.com/golang/groupcache/lru # github.com/google/uuid v1.3.0 ## explicit github.com/google/uuid -# github.com/gookit/color v1.5.3 +# github.com/gookit/color v1.5.4 ## explicit; go 1.18 github.com/gookit/color # github.com/hashicorp/go-version v1.6.0 @@ -240,7 +240,7 @@ github.com/pjbgf/sha1cd/ubc # github.com/pkg/errors v0.9.1 ## explicit github.com/pkg/errors -# github.com/pterm/pterm v0.12.63 +# github.com/pterm/pterm v0.12.66 ## explicit; go 1.18 github.com/pterm/pterm github.com/pterm/pterm/internal @@ -265,8 +265,6 @@ github.com/spf13/cobra # github.com/spf13/pflag v1.0.5 ## explicit; go 1.12 github.com/spf13/pflag -# github.com/stretchr/testify v1.8.1 -## explicit; go 1.13 # github.com/xanzy/ssh-agent v0.3.3 ## explicit; go 1.16 github.com/xanzy/ssh-agent