From 50e7b0ecd1da5bad56a991a727f8ad8bc184b7aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 23:59:14 +0000 Subject: [PATCH 1/4] chore(deps): bump github.com/charmbracelet/bubbletea in /examples (#484) Bumps [github.com/charmbracelet/bubbletea](https://github.com/charmbracelet/bubbletea) from 1.2.3 to 1.2.4. - [Release notes](https://github.com/charmbracelet/bubbletea/releases) - [Changelog](https://github.com/charmbracelet/bubbletea/blob/main/.goreleaser.yml) - [Commits](https://github.com/charmbracelet/bubbletea/compare/v1.2.3...v1.2.4) --- updated-dependencies: - dependency-name: github.com/charmbracelet/bubbletea 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> --- examples/go.mod | 2 +- examples/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/go.mod b/examples/go.mod index f1c4c83..3cfad73 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -4,7 +4,7 @@ go 1.22 require ( github.com/charmbracelet/bubbles v0.20.0 - github.com/charmbracelet/bubbletea v1.2.3 + github.com/charmbracelet/bubbletea v1.2.4 github.com/charmbracelet/glamour v0.8.0 github.com/charmbracelet/huh v0.0.0-00010101000000-000000000000 github.com/charmbracelet/huh/spinner v0.0.0-00010101000000-000000000000 diff --git a/examples/go.sum b/examples/go.sum index 4041ccb..b13c13c 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -20,8 +20,8 @@ github.com/catppuccin/go v0.2.0 h1:ktBeIrIP42b/8FGiScP9sgrWOss3lw0Z5SktRoithGA= github.com/catppuccin/go v0.2.0/go.mod h1:8IHJuMGaUUjQM82qBrGNBv7LFq6JI3NnQCF6MOlZjpc= github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE= github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU= -github.com/charmbracelet/bubbletea v1.2.3 h1:d9MdMsANIYZB5pE1KkRqaUV6GfsiWm+/9z4fTuGVm9I= -github.com/charmbracelet/bubbletea v1.2.3/go.mod h1:Qr6fVQw+wX7JkWWkVyXYk/ZUQ92a6XNekLXa3rR18MM= +github.com/charmbracelet/bubbletea v1.2.4 h1:KN8aCViA0eps9SCOThb2/XPIlea3ANJLUkv3KnQRNCE= +github.com/charmbracelet/bubbletea v1.2.4/go.mod h1:Qr6fVQw+wX7JkWWkVyXYk/ZUQ92a6XNekLXa3rR18MM= github.com/charmbracelet/glamour v0.8.0 h1:tPrjL3aRcQbn++7t18wOpgLyl8wrOHUEDS7IZ68QtZs= github.com/charmbracelet/glamour v0.8.0/go.mod h1:ViRgmKkf3u5S7uakt2czJ272WSg2ZenlYEZXT2x7Bjw= github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ= From dba9876e3e8aa4e3cecc92ab47441c41369b822a Mon Sep 17 00:00:00 2001 From: Antoine Grondin Date: Wed, 27 Nov 2024 21:54:09 +0900 Subject: [PATCH 2/4] fix(accessibility): stop scanning on EOF from stdin (#440) --- accessibility/accessibility.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/accessibility/accessibility.go b/accessibility/accessibility.go index 60accc1..edf7829 100644 --- a/accessibility/accessibility.go +++ b/accessibility/accessibility.go @@ -78,7 +78,12 @@ func PromptString(prompt string, validator func(input string) error) string { for !valid { fmt.Print(prompt) - _ = scanner.Scan() + if !scanner.Scan() { + // no way to bubble up errors or signal cancellation + // but the program is probably not continuing if + // stdin sent EOF + break + } input = scanner.Text() err := validator(input) From 2522a15a73c67ab857af4f4d721685669e611d44 Mon Sep 17 00:00:00 2001 From: Jared Allard Date: Wed, 27 Nov 2024 04:54:36 -0800 Subject: [PATCH 3/4] fix(accessibility): parseBool defaults to no (#442) Matching the prompt of "Choose [y/N]:" default is now equal to N. Resolves https://github.com/charmbracelet/huh/issues/264 --- accessibility/accessibility.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/accessibility/accessibility.go b/accessibility/accessibility.go index edf7829..83e3e55 100644 --- a/accessibility/accessibility.go +++ b/accessibility/accessibility.go @@ -42,7 +42,9 @@ func parseBool(s string) (bool, error) { } } - for _, n := range []string{"n", "no"} { + // As a special case, we default to "" to no since the usage of this + // function suggests N is the default. + for _, n := range []string{"", "n", "no"} { if n == s { return false, nil } From aad810dfbce6008f9f66c157f4790e41a29deffb Mon Sep 17 00:00:00 2001 From: Sculas Date: Wed, 27 Nov 2024 13:57:41 +0100 Subject: [PATCH 4/4] fix(input): Skip validation when going to previous field (#285) In my opinion, this would make user experience better. Say you made a typo in the previous field but you already went to the next one, now you *need* to fill the current field correctly before you can fix the previous field. This also keeps validation intact, because the field still needs to be valid to progress to the next field. --- field_input.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/field_input.go b/field_input.go index 3510d52..8cf137e 100644 --- a/field_input.go +++ b/field_input.go @@ -342,11 +342,6 @@ func (i *Input) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch { case key.Matches(msg, i.keymap.Prev): - value := i.textinput.Value() - i.err = i.validate(value) - if i.err != nil { - return i, nil - } cmds = append(cmds, PrevField) case key.Matches(msg, i.keymap.Next, i.keymap.Submit): value := i.textinput.Value()