From b6ab3d4023d8b4f6b15f852bf3a420f8c891e112 Mon Sep 17 00:00:00 2001 From: "mend-for-github-com[bot]" <50673670+mend-for-github-com[bot]@users.noreply.github.com> Date: Tue, 10 Jan 2023 13:55:15 -0600 Subject: [PATCH] =?UTF-8?q?chore(deps):=20update=20=E2=AC=86=EF=B8=8F=20go?= =?UTF-8?q?lang=20module=20github.com/pterm/pterm=20to=20v0.12.53=20(#44)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/pterm/pterm](https://togithub.com/pterm/pterm) | require | patch | `v0.12.50` -> `v0.12.53` | --- ### āš  Dependency Lookup Warnings āš  Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information. --- ### Release Notes
pterm/pterm ### [`v0.12.53`](https://togithub.com/pterm/pterm/releases/tag/v0.12.53) [Compare Source](https://togithub.com/pterm/pterm/compare/v0.12.52...v0.12.53) #### What's Changed ##### Exciting New Features šŸŽ‰ - feat(color): added `color.ToStyle()` by [@​MarvinJWendt](https://togithub.com/MarvinJWendt) in [https://github.com/pterm/pterm/pull/435](https://togithub.com/pterm/pterm/pull/435) - feat(progressbar): added optional title to `Start` method by [@​MarvinJWendt](https://togithub.com/MarvinJWendt) in [https://github.com/pterm/pterm/pull/436](https://togithub.com/pterm/pterm/pull/436) ##### Fixes šŸ”§ - fix(prefix): fixed line numbers in different print functions by [@​MarvinJWendt](https://togithub.com/MarvinJWendt) in [https://github.com/pterm/pterm/pull/437](https://togithub.com/pterm/pterm/pull/437) **Full Changelog**: https://github.com/pterm/pterm/compare/v0.12.52...v0.12.53 ### [`v0.12.52`](https://togithub.com/pterm/pterm/blob/HEAD/CHANGELOG.md#v01252---2023-01-05) [Compare Source](https://togithub.com/pterm/pterm/compare/v0.12.51...v0.12.52) ##### Features - **multiselect:** added theme support for checkmarks - **multiselect:** added theme support for checkmarks ##### Test - **multiselect:** fixed test ##### Code Refactoring - **progressbar:** make add more safe ### [`v0.12.51`](https://togithub.com/pterm/pterm/blob/HEAD/CHANGELOG.md#v01251---2022-12-24) [Compare Source](https://togithub.com/pterm/pterm/compare/v0.12.50...v0.12.51) ##### Bug Fixes - Make sure the confirm printer can clean up after Ctrl+C
--- ### Configuration šŸ“… **Schedule**: Branch creation - "before 3am on Monday" (UTC), Automerge - At any time (no schedule defined). šŸš¦ **Automerge**: Enabled. ā™» **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. šŸ”• **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. Co-authored-by: mend-for-github-com[bot] <50673670+mend-for-github-com[bot]@users.noreply.github.com> --- go.mod | 4 +- go.sum | 8 ++-- vendor/github.com/pterm/pterm/CHANGELOG.md | 45 ++++++++++++++++--- vendor/github.com/pterm/pterm/CONTRIBUTING.md | 8 ++++ vendor/github.com/pterm/pterm/README.md | 39 ++++++++++++++++ vendor/github.com/pterm/pterm/area_printer.go | 4 +- vendor/github.com/pterm/pterm/atoms.go | 6 +++ vendor/github.com/pterm/pterm/color.go | 5 +++ .../pterm/interactive_confirm_printer.go | 20 ++++++--- .../pterm/interactive_continue_printer.go | 5 ++- .../pterm/interactive_multiselect_printer.go | 13 +++++- .../pterm/pterm/interactive_select_printer.go | 6 +-- .../github.com/pterm/pterm/prefix_printer.go | 7 ++- vendor/github.com/pterm/pterm/print.go | 7 +-- .../pterm/pterm/progressbar_printer.go | 7 ++- vendor/github.com/pterm/pterm/theme.go | 5 +++ .../golang.org/x/text/unicode/bidi/trieval.go | 12 ----- vendor/modules.txt | 4 +- 18 files changed, 158 insertions(+), 47 deletions(-) diff --git a/go.mod b/go.mod index 5c52b775..231c2a33 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/peterbourgon/diskv/v3 v3.0.1 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 github.com/posener/complete v1.2.3 - github.com/pterm/pterm v0.12.50 + github.com/pterm/pterm v0.12.53 github.com/savaki/jq v0.0.0-20161209013833-0e6baecebbf8 github.com/sheldonhull/magetools v1.0.0 github.com/shurcooL/graphql v0.0.0-20220606043923-3cf50f8a0a29 @@ -125,7 +125,7 @@ require ( golang.org/x/mod v0.6.0 // indirect golang.org/x/net v0.1.0 // indirect golang.org/x/term v0.1.0 // indirect - golang.org/x/text v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect golang.org/x/tools v0.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect diff --git a/go.sum b/go.sum index ffed9ac8..26b9dd24 100644 --- a/go.sum +++ b/go.sum @@ -376,8 +376,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.50 h1:53nKg5lLI1kXkvLWq2IQI5rgkPkFzEQsuQjxAb39VlE= -github.com/pterm/pterm v0.12.50/go.mod h1:79BLm4vos2z+eOoHnDG7ZWuYtLaSStyaspKjGmSoxc4= +github.com/pterm/pterm v0.12.53 h1:8ERV5eXyvXlAIY8LRrhapPS34j7IKKDAnb7o1Ih3T0w= +github.com/pterm/pterm v0.12.53/go.mod h1:BY2H3GtX2BX0ULqLY11C2CusIqnxsYerbkil3XvXIBg= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.2 h1:YwD0ulJSJytLpiaWua0sBDusfsCZohxjxzVTYjwxfV8= github.com/rivo/uniseg v0.4.2/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= @@ -611,8 +611,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/vendor/github.com/pterm/pterm/CHANGELOG.md b/vendor/github.com/pterm/pterm/CHANGELOG.md index 9c11820a..1d7f079a 100644 --- a/vendor/github.com/pterm/pterm/CHANGELOG.md +++ b/vendor/github.com/pterm/pterm/CHANGELOG.md @@ -1,6 +1,36 @@ ## [Unreleased] +### Features +- **color:** added `color.ToStyle()` +- **color:** added `color.ToStyle()` +- **progressbar:** added optional title to `Start` method + +### Bug Fixes +- **prefix:** fixed line numbers in different print functions + + + +## [v0.12.52] - 2023-01-05 +### Features +- **multiselect:** added theme support for checkmarks +- **multiselect:** added theme support for checkmarks + +### Test +- **multiselect:** fixed test + +### Code Refactoring +- **progressbar:** make add more safe + + + +## [v0.12.51] - 2022-12-24 +### Bug Fixes +- Make sure the confirm printer can clean up after Ctrl+C + + + +## [v0.12.50] - 2022-11-22 ### Bug Fixes - revert original test & add new test - slice bounds out of range on select printer @@ -490,13 +520,13 @@ ### Code Refactoring - remove analytics -- **boxprinter:** change from `RenderablePrinter` to `TextPrinter` - **boxprinter:** return theme when style is nil - **boxprinter:** change `DefaultBox` top and bottom padding to 0 - **boxprinter:** fix spacing between boxes and in boxes - **boxprinter:** refactor code -- **panelprinter:** optional border for `Panel` +- **boxprinter:** change from `RenderablePrinter` to `TextPrinter` - **panelprinter:** add `BoxPrinter` to surround panels with a fully custom box +- **panelprinter:** optional border for `Panel` @@ -583,8 +613,8 @@ - **panel:** add test for `WithBottomPadding` - **panel:** add test for `WithSameColumnWidth` & multiple `panel` - **panel:** add test for `WithSameColumnWidth` -- **progressbar:** change `Progressbar` to `ProgressbarPrinter` - **progressbar:** change directory name `progressbar_test` to `progressbar_printer_test` +- **progressbar:** change `Progressbar` to `ProgressbarPrinter` - **spinner:** change directory name `spinner_test` to `spinner_printer_test` - **spinner:** change `Spinner` to `SpinnerPrinter` - **table:** change `Table` to `TablePrinter` @@ -599,8 +629,8 @@ - **progressbar:** change `ActiveProgressbars` to `ActiveProgressbarPrinters` - **progressbar:** change directory name `progressbar` to `progressbar_printer` - **progressbar:** change `Progressbar` to `ProgressbarPrinter` -- **spinner:** change `Spinner` to `SpinnerPrinter` - **spinner:** change directory name `spinner` to `spinner_printer` +- **spinner:** change `Spinner` to `SpinnerPrinter` - **table:** change `Table` to `TablePrinter` - **tree:** change `Tree` to `TreePrinter` @@ -694,10 +724,10 @@ The global variable `DisableOutput` was renamed to `Output`. - **tree:** add Indent to control the spacing between levels and changed docs(examples) - **tree:** add more spacing between levels - **tree:** refactor `Tree` code and write tests for `Tree` +- **tree:** refactor `Tree` code and write tests for `Tree` - **tree:** refactor `Tree` code - **tree:** refactor `Tree` code - **tree:** refactor `Tree` code -- **tree:** refactor `Tree` code and write tests for `Tree` @@ -1076,7 +1106,10 @@ removed `Header` and put it's content directly into `HeaderPrinter` - initial commit -[Unreleased]: https://github.com/pterm/pterm/compare/v0.12.49...HEAD +[Unreleased]: https://github.com/pterm/pterm/compare/v0.12.52...HEAD +[v0.12.52]: https://github.com/pterm/pterm/compare/v0.12.51...v0.12.52 +[v0.12.51]: https://github.com/pterm/pterm/compare/v0.12.50...v0.12.51 +[v0.12.50]: https://github.com/pterm/pterm/compare/v0.12.49...v0.12.50 [v0.12.49]: https://github.com/pterm/pterm/compare/v0.12.48...v0.12.49 [v0.12.48]: https://github.com/pterm/pterm/compare/v0.12.47...v0.12.48 [v0.12.47]: https://github.com/pterm/pterm/compare/v0.12.46...v0.12.47 diff --git a/vendor/github.com/pterm/pterm/CONTRIBUTING.md b/vendor/github.com/pterm/pterm/CONTRIBUTING.md index 73d392dd..6491ad20 100644 --- a/vendor/github.com/pterm/pterm/CONTRIBUTING.md +++ b/vendor/github.com/pterm/pterm/CONTRIBUTING.md @@ -3,6 +3,14 @@ > This document explains how to participate in the development of PTerm.\ If your goal is to report a bug instead of programming PTerm, you can do so [here](https://github.com/pterm/pterm/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc). +## Best practise + +We enforce some best practises, especially made for PTerm, to provide a clean and consistent user experience. + +### Styles + +Styles should always be consumed as pointers. That way, the user can change the style of printers globally. + ## Creating a new printer > In this chapter we will show you how to create a new printer. diff --git a/vendor/github.com/pterm/pterm/README.md b/vendor/github.com/pterm/pterm/README.md index cfe4f34c..191ed3c0 100644 --- a/vendor/github.com/pterm/pterm/README.md +++ b/vendor/github.com/pterm/pterm/README.md @@ -1091,6 +1091,45 @@ func main() { +### interactive_multiselect/custom-checkmarks + +![Animation](https://raw.githubusercontent.com/pterm/pterm/master/_examples/interactive_multiselect/custom-checkmarks/animation.svg) + +
+ +SHOW SOURCE + +```go +package main + +import ( + "fmt" + + "atomicgo.dev/keyboard/keys" + + "github.com/pterm/pterm" +) + +func main() { + var options []string + + for i := 0; i < 5; i++ { + options = append(options, fmt.Sprintf("Option %d", i)) + } + + printer := pterm.DefaultInteractiveMultiselect.WithOptions(options) + printer.Filter = false + printer.KeyConfirm = keys.Enter + printer.KeySelect = keys.Space + printer.Checkmark = &pterm.Checkmark{Checked: pterm.Green("+"), Unchecked: pterm.Red("-")} + selectedOptions, _ := printer.Show() + pterm.Info.Printfln("Selected options: %s", pterm.Green(selectedOptions)) +} + +``` + +
+ ### interactive_multiselect/custom-keys ![Animation](https://raw.githubusercontent.com/pterm/pterm/master/_examples/interactive_multiselect/custom-keys/animation.svg) diff --git a/vendor/github.com/pterm/pterm/area_printer.go b/vendor/github.com/pterm/pterm/area_printer.go index 721341c3..5f3e5b04 100644 --- a/vendor/github.com/pterm/pterm/area_printer.go +++ b/vendor/github.com/pterm/pterm/area_printer.go @@ -125,8 +125,8 @@ func (p *AreaPrinter) GenericStop() (*LivePrinter, error) { return &lp, nil } -// Wrapper function that clears the content of the Area. -// Moves the cursor to the bottom of the terminal, clears n lines upwards from +// Clear is a Wrapper function that clears the content of the Area +// moves the cursor to the bottom of the terminal, clears n lines upwards from // the current position and moves the cursor again. func (p *AreaPrinter) Clear() { p.area.Clear() diff --git a/vendor/github.com/pterm/pterm/atoms.go b/vendor/github.com/pterm/pterm/atoms.go index d2410923..bc11da24 100644 --- a/vendor/github.com/pterm/pterm/atoms.go +++ b/vendor/github.com/pterm/pterm/atoms.go @@ -1,5 +1,11 @@ package pterm +// Checkmark is used in the interactive multiselect printer. +type Checkmark struct { + Checked string + Unchecked string +} + // Bars is used to display multiple Bar. type Bars []Bar diff --git a/vendor/github.com/pterm/pterm/color.go b/vendor/github.com/pterm/pterm/color.go index 3626ee47..5f7eeef3 100644 --- a/vendor/github.com/pterm/pterm/color.go +++ b/vendor/github.com/pterm/pterm/color.go @@ -246,6 +246,11 @@ func (c Color) String() string { return fmt.Sprintf("%d", c) } +// ToStyle converts the color to a style. +func (c Color) ToStyle() *Style { + return &Style{c} +} + // Style is a collection of colors. // Can include foreground, background and styling (eg. Bold, Underscore, etc.) colors. type Style []Color diff --git a/vendor/github.com/pterm/pterm/interactive_confirm_printer.go b/vendor/github.com/pterm/pterm/interactive_confirm_printer.go index dc37e597..6760ce69 100644 --- a/vendor/github.com/pterm/pterm/interactive_confirm_printer.go +++ b/vendor/github.com/pterm/pterm/interactive_confirm_printer.go @@ -2,12 +2,12 @@ package pterm import ( "fmt" - "os" "strings" "atomicgo.dev/cursor" "atomicgo.dev/keyboard" "atomicgo.dev/keyboard/keys" + "github.com/pterm/pterm/internal" ) var ( @@ -89,9 +89,15 @@ func (p InteractiveConfirmPrinter) WithSuffixStyle(style *Style) *InteractiveCon // Show shows the confirm prompt. // // Example: -// result, _ := pterm.DefaultInteractiveConfirm.Show("Are you sure?") -// pterm.Println(result) +// +// result, _ := pterm.DefaultInteractiveConfirm.Show("Are you sure?") +// pterm.Println(result) func (p InteractiveConfirmPrinter) Show(text ...string) (bool, error) { + // should be the first defer statement to make sure it is executed last + // and all the needed cleanup can be done before + cancel, exit := internal.NewCancelationSignal() + defer exit() + var result bool if len(text) == 0 || text[0] == "" { @@ -101,6 +107,7 @@ func (p InteractiveConfirmPrinter) Show(text ...string) (bool, error) { p.TextStyle.Print(text[0] + " " + p.getSuffix() + ": ") y, n := p.getShortHandles() + var interrupted bool err := keyboard.Listen(func(keyInfo keys.Key) (stop bool, err error) { key := keyInfo.Code char := strings.ToLower(keyInfo.String()) @@ -132,12 +139,15 @@ func (p InteractiveConfirmPrinter) Show(text ...string) (bool, error) { result = p.DefaultValue return true, nil case keys.CtrlC: - os.Exit(1) + cancel() + interrupted = true return true, nil } return false, nil }) - cursor.StartOfLine() + if !interrupted { + cursor.StartOfLine() + } return result, err } diff --git a/vendor/github.com/pterm/pterm/interactive_continue_printer.go b/vendor/github.com/pterm/pterm/interactive_continue_printer.go index 8f8f67de..d0f91f13 100644 --- a/vendor/github.com/pterm/pterm/interactive_continue_printer.go +++ b/vendor/github.com/pterm/pterm/interactive_continue_printer.go @@ -111,8 +111,9 @@ func (p InteractiveContinuePrinter) WithSuffixStyle(style *Style) *InteractiveCo // Show shows the continue prompt. // // Example: -// result, _ := pterm.DefaultInteractiveContinue.Show("Do you want to apply the changes?") -// pterm.Println(result) +// +// result, _ := pterm.DefaultInteractiveContinue.Show("Do you want to apply the changes?") +// pterm.Println(result) func (p InteractiveContinuePrinter) Show(text ...string) (string, error) { var result string diff --git a/vendor/github.com/pterm/pterm/interactive_multiselect_printer.go b/vendor/github.com/pterm/pterm/interactive_multiselect_printer.go index dc6be6b2..b55a92c8 100644 --- a/vendor/github.com/pterm/pterm/interactive_multiselect_printer.go +++ b/vendor/github.com/pterm/pterm/interactive_multiselect_printer.go @@ -8,6 +8,7 @@ import ( "atomicgo.dev/keyboard" "atomicgo.dev/keyboard/keys" "github.com/lithammer/fuzzysearch/fuzzy" + "github.com/pterm/pterm/internal" ) @@ -25,6 +26,7 @@ var ( Filter: true, KeySelect: keys.Enter, KeyConfirm: keys.Tab, + Checkmark: &ThemeDefault.Checkmark, } ) @@ -39,6 +41,7 @@ type InteractiveMultiselectPrinter struct { Selector string SelectorStyle *Style Filter bool + Checkmark *Checkmark selectedOption int selectedOptions []int @@ -95,6 +98,12 @@ func (p InteractiveMultiselectPrinter) WithKeyConfirm(keyConfirm keys.KeyCode) * return &p } +// WithCheckmark sets the checkmark +func (p InteractiveMultiselectPrinter) WithCheckmark(checkmark *Checkmark) *InteractiveMultiselectPrinter { + p.Checkmark = checkmark + return &p +} + // Show shows the interactive multiselect menu and returns the selected entry. func (p *InteractiveMultiselectPrinter) Show(text ...string) ([]string, error) { // should be the first defer statement to make sure it is executed last @@ -345,9 +354,9 @@ func (p *InteractiveMultiselectPrinter) renderSelectMenu() string { } var checkmark string if p.isSelected(option) { - checkmark = fmt.Sprintf("[%s]", Green("āœ“")) + checkmark = fmt.Sprintf("[%s]", p.Checkmark.Checked) } else { - checkmark = fmt.Sprintf("[%s]", Red("āœ—")) + checkmark = fmt.Sprintf("[%s]", p.Checkmark.Unchecked) } if i == p.selectedOption { content += Sprintf("%s %s %s\n", p.renderSelector(), checkmark, option) diff --git a/vendor/github.com/pterm/pterm/interactive_select_printer.go b/vendor/github.com/pterm/pterm/interactive_select_printer.go index ccc89804..1745f13f 100644 --- a/vendor/github.com/pterm/pterm/interactive_select_printer.go +++ b/vendor/github.com/pterm/pterm/interactive_select_printer.go @@ -245,7 +245,7 @@ func (p *InteractiveSelectPrinter) Show(text ...string) (string, error) { func (p *InteractiveSelectPrinter) renderSelectMenu() string { var content string - content += Sprintf("%s %s: %s\n", p.text, ThemeDefault.SecondaryStyle.Sprint("[type to search]"), p.fuzzySearchString) + content += Sprintf("%s %s: %s\n", p.text, p.SelectorStyle.Sprint("[type to search]"), p.fuzzySearchString) // find options that match fuzzy search string rankedResults := fuzzy.RankFindFold(p.fuzzySearchString, p.Options) @@ -275,9 +275,9 @@ func (p *InteractiveSelectPrinter) renderSelectMenu() string { continue } if i == p.selectedOption { - content += Sprintf("%s %s\n", p.renderSelector(), option) + content += Sprintf("%s %s\n", p.renderSelector(), p.OptionStyle.Sprint(option)) } else { - content += Sprintf(" %s\n", option) + content += Sprintf(" %s\n", p.OptionStyle.Sprint(option)) } } diff --git a/vendor/github.com/pterm/pterm/prefix_printer.go b/vendor/github.com/pterm/pterm/prefix_printer.go index ea0180ce..6823c94c 100644 --- a/vendor/github.com/pterm/pterm/prefix_printer.go +++ b/vendor/github.com/pterm/pterm/prefix_printer.go @@ -199,9 +199,8 @@ func (p *PrefixPrinter) Sprint(a ...interface{}) string { } } - _, fileName, line, _ := runtime.Caller(3 + p.LineNumberOffset) - if p.ShowLineNumber { + _, fileName, line, _ := runtime.Caller(3 + p.LineNumberOffset) ret += FgGray.Sprint("\nā”” " + fmt.Sprintf("(%s:%d)\n", fileName, line)) newLine = false } @@ -248,7 +247,9 @@ func (p *PrefixPrinter) Print(a ...interface{}) *TextPrinter { if p.Debugger && !PrintDebugMessages { return &tp } + p.LineNumberOffset-- Fprint(p.Writer, p.Sprint(a...)) + p.LineNumberOffset++ checkFatal(p) return &tp } @@ -286,7 +287,9 @@ func (p *PrefixPrinter) Printfln(format string, a ...interface{}) *TextPrinter { if p.Debugger && !PrintDebugMessages { return &tp } + p.LineNumberOffset++ Fprint(p.Writer, p.Sprintfln(format, a...)) + p.LineNumberOffset-- checkFatal(p) return &tp } diff --git a/vendor/github.com/pterm/pterm/print.go b/vendor/github.com/pterm/pterm/print.go index 6a2612d8..a58e5fa6 100644 --- a/vendor/github.com/pterm/pterm/print.go +++ b/vendor/github.com/pterm/pterm/print.go @@ -149,9 +149,10 @@ func Fprintln(writer io.Writer, a ...interface{}) { // Printo overrides the current line in a terminal. // If the current line is empty, the text will be printed like with pterm.Print. // Example: -// pterm.Printo("Hello, World") -// time.Sleep(time.Second) -// pterm.Printo("Hello, Earth!") +// +// pterm.Printo("Hello, World") +// time.Sleep(time.Second) +// pterm.Printo("Hello, Earth!") func Printo(a ...interface{}) { if !Output { return diff --git a/vendor/github.com/pterm/pterm/progressbar_printer.go b/vendor/github.com/pterm/pterm/progressbar_printer.go index d4cee2fa..2fb3f910 100644 --- a/vendor/github.com/pterm/pterm/progressbar_printer.go +++ b/vendor/github.com/pterm/pterm/progressbar_printer.go @@ -250,18 +250,21 @@ func (p *ProgressbarPrinter) Add(count int) *ProgressbarPrinter { p.Current += count p.updateProgress() - if p.Current == p.Total { + if p.Current >= p.Total { p.Stop() } return p } // Start the ProgressbarPrinter. -func (p ProgressbarPrinter) Start() (*ProgressbarPrinter, error) { +func (p ProgressbarPrinter) Start(title ...interface{}) (*ProgressbarPrinter, error) { if RawOutput && p.ShowTitle { Fprintln(p.Writer, p.Title) } p.IsActive = true + if len(title) != 0 { + p.Title = Sprint(title...) + } ActiveProgressBarPrinters = append(ActiveProgressBarPrinters, &p) p.startedAt = time.Now() diff --git a/vendor/github.com/pterm/pterm/theme.go b/vendor/github.com/pterm/pterm/theme.go index b02ac3e2..22466ea7 100644 --- a/vendor/github.com/pterm/pterm/theme.go +++ b/vendor/github.com/pterm/pterm/theme.go @@ -43,6 +43,10 @@ var ( BarLabelStyle: Style{FgLightCyan}, BarStyle: Style{FgCyan}, TimerStyle: Style{FgGray}, + Checkmark: Checkmark{ + Checked: Green("āœ“"), + Unchecked: Red("āœ—"), + }, } ) @@ -89,6 +93,7 @@ type Theme struct { BoxTextStyle Style BarLabelStyle Style BarStyle Style + Checkmark Checkmark } // WithPrimaryStyle returns a new theme with overridden value. diff --git a/vendor/golang.org/x/text/unicode/bidi/trieval.go b/vendor/golang.org/x/text/unicode/bidi/trieval.go index 4c459c4b..6a796e22 100644 --- a/vendor/golang.org/x/text/unicode/bidi/trieval.go +++ b/vendor/golang.org/x/text/unicode/bidi/trieval.go @@ -37,18 +37,6 @@ const ( unknownClass = ^Class(0) ) -var controlToClass = map[rune]Class{ - 0x202D: LRO, // LeftToRightOverride, - 0x202E: RLO, // RightToLeftOverride, - 0x202A: LRE, // LeftToRightEmbedding, - 0x202B: RLE, // RightToLeftEmbedding, - 0x202C: PDF, // PopDirectionalFormat, - 0x2066: LRI, // LeftToRightIsolate, - 0x2067: RLI, // RightToLeftIsolate, - 0x2068: FSI, // FirstStrongIsolate, - 0x2069: PDI, // PopDirectionalIsolate, -} - // A trie entry has the following bits: // 7..5 XOR mask for brackets // 4 1: Bracket open, 0: Bracket close diff --git a/vendor/modules.txt b/vendor/modules.txt index 3b45d3dc..631aa5fd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -407,7 +407,7 @@ github.com/pmezard/go-difflib/difflib github.com/posener/complete github.com/posener/complete/cmd github.com/posener/complete/cmd/install -# github.com/pterm/pterm v0.12.50 +# github.com/pterm/pterm v0.12.53 ## explicit; go 1.18 github.com/pterm/pterm github.com/pterm/pterm/internal @@ -537,7 +537,7 @@ golang.org/x/sys/windows # golang.org/x/term v0.1.0 ## explicit; go 1.17 golang.org/x/term -# golang.org/x/text v0.4.0 +# golang.org/x/text v0.6.0 ## explicit; go 1.17 golang.org/x/text/cases golang.org/x/text/internal