Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
202c1ad
feat(prompter): add accessible prompter support
BagToad Mar 31, 2025
7b0c095
feat(md prompter): md prompt respects blankAllowed
BagToad Mar 31, 2025
e973ee3
fix(md prompter): accessible prompt allows blank
BagToad Mar 31, 2025
92b1a8e
test(prompter): remove t.parallel calls
BagToad Mar 31, 2025
88a98ea
feat(prompter): include `no` as false-y value
BagToad Apr 2, 2025
f7de9e0
test(prompter): `go-expect` based prompter tests
BagToad Apr 2, 2025
94bbd26
fix(prompter): rename huhprompter
BagToad Apr 2, 2025
0d7fd36
test(prompter): replace assert with require
BagToad Apr 2, 2025
e42af35
tests(prompter): rename huhprompter
BagToad Apr 2, 2025
e299b56
test(prompter): remove needless variable declaration
BagToad Apr 2, 2025
8827803
test(prompter): skip vt10x tests on Windows
BagToad Apr 2, 2025
88e6285
test(prompter): move to external package
BagToad Apr 3, 2025
02fc12e
fix(linter): linter errors
BagToad Apr 3, 2025
49ddacf
docs(prompter): doc prompter interface
BagToad Apr 3, 2025
a30df14
refactor(prompter): rename env var for speech synthesizer friendly pr…
BagToad Apr 3, 2025
5b0d49c
test(prompter): more tests for bad input
BagToad Apr 4, 2025
4cf048a
fix(prompter): input returns default when blank
BagToad Apr 4, 2025
5c39e0b
fix(prompter): notes about Confirm default
BagToad Apr 4, 2025
2e48cad
fix(prompter): remove impossible condition
BagToad Apr 4, 2025
0b49522
refactor(prompter): less magic strings
BagToad Apr 4, 2025
f897001
doc(prompter): clarify comments
BagToad Apr 4, 2025
5996f88
doc(envs): speech synthesis prompter
BagToad Apr 7, 2025
2a851e3
test(prompter): fix race conditions
BagToad Apr 7, 2025
0543aac
test(prompter): add basic survey prompter test
BagToad Apr 7, 2025
6640740
doc: comment typos and formatting
BagToad Apr 7, 2025
c5ffb3c
test: use example.com in tests
BagToad Apr 7, 2025
fb80b5b
test(prompter): remove needless NO_COLOR set
BagToad Apr 7, 2025
d8d3874
fix(prompter): use os.lookupenv for accessible prompter
BagToad Apr 8, 2025
ef58e62
test(prompter): timeout for tests is 1s
BagToad Apr 8, 2025
c4be95a
refactor(prompter): remove unused variable
BagToad Apr 8, 2025
8821f77
doc(prompter): remove senseless comment
BagToad Apr 8, 2025
9cf3413
refactor(prompter): explicit return values
BagToad Apr 8, 2025
19387b8
fix(prompter): rename GH_ACCESSIBLE_PROMPTER
BagToad Apr 8, 2025
fa03157
doc(help): label GH_ACCESSIBLE_PROMPTER as preview
BagToad Apr 8, 2025
d230b08
test(prompter): re-add skipped test for accessible confirm default
BagToad Apr 8, 2025
8615632
Merge branch 'trunk' into kw/first-pass-accessible-prompter
BagToad Apr 9, 2025
3b2e7f7
chore: go mod tidy
BagToad Apr 9, 2025
a34c9ea
doc(prompter env): accessible prompter includes braille reader
BagToad Apr 9, 2025
8fc8486
refactor(prompter): rename speechSynthesizerFriendlyPrompter to acces…
BagToad Apr 9, 2025
2f5e896
fix(prompter): update `huh` and fix tests
BagToad Apr 9, 2025
fab0de5
fix(prompter): pass io to `huh` and refactor tests
BagToad Apr 9, 2025
4615069
chore: go mod tidy
BagToad Apr 9, 2025
47d6032
test(prompter): use *testing.T instead
BagToad Apr 10, 2025
8b70870
test(prompter): describe why echo is editorcmd
BagToad Apr 10, 2025
9eee77a
test(prompter): doc how accessible prompter tests work
BagToad Apr 10, 2025
20ff409
fix(prompter): remove needless default value assignment
BagToad Apr 10, 2025
b8cd094
Ensure markdown confirm prompt shows editor name
andyfeller Apr 10, 2025
8cd3992
test(prompter): fix race condition
BagToad Apr 10, 2025
70537de
test(prompter): fix invalid comment
BagToad Apr 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(prompter): skip vt10x tests on Windows
  • Loading branch information
BagToad committed Apr 3, 2025
commit 8827803bd1d864f2a39076e60052c6dcdea4cb84
26 changes: 13 additions & 13 deletions internal/prompter/prompter.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func New(editorCmd string, stdin ghPrompter.FileReader, stdout ghPrompter.FileWr
editorCmd: editorCmd,
}
default:
return &SpeechSynthesizerFriendlyPrompter{
return &speechSynthesizerFriendlyPrompter{
stdin: stdin,
stdout: stdout,
stderr: stderr,
Expand All @@ -51,7 +51,7 @@ func New(editorCmd string, stdin ghPrompter.FileReader, stdout ghPrompter.FileWr
}
}

type SpeechSynthesizerFriendlyPrompter struct {
type speechSynthesizerFriendlyPrompter struct {
stdin ghPrompter.FileReader
stdout ghPrompter.FileWriter
stderr ghPrompter.FileWriter
Expand All @@ -60,18 +60,18 @@ type SpeechSynthesizerFriendlyPrompter struct {
}

// IsAccessible returns true if the huhPrompter was created in accessible mode.
func (p *SpeechSynthesizerFriendlyPrompter) IsAccessible() bool {
func (p *speechSynthesizerFriendlyPrompter) IsAccessible() bool {
return p.accessible
}

func (p *SpeechSynthesizerFriendlyPrompter) newForm(groups ...*huh.Group) *huh.Form {
func (p *speechSynthesizerFriendlyPrompter) newForm(groups ...*huh.Group) *huh.Form {
return huh.NewForm(groups...).
WithTheme(huh.ThemeBase16()).
WithAccessible(p.accessible).
WithProgramOptions(tea.WithOutput(p.stdout), tea.WithInput(p.stdin))
}

func (p *SpeechSynthesizerFriendlyPrompter) Select(prompt, _ string, options []string) (int, error) {
func (p *speechSynthesizerFriendlyPrompter) Select(prompt, _ string, options []string) (int, error) {
var result int
formOptions := []huh.Option[int]{}
for i, o := range options {
Expand All @@ -91,7 +91,7 @@ func (p *SpeechSynthesizerFriendlyPrompter) Select(prompt, _ string, options []s
return result, err
}

func (p *SpeechSynthesizerFriendlyPrompter) MultiSelect(prompt string, defaults []string, options []string) ([]int, error) {
func (p *speechSynthesizerFriendlyPrompter) MultiSelect(prompt string, defaults []string, options []string) ([]int, error) {
var result []int
formOptions := make([]huh.Option[int], len(options))
for i, o := range options {
Expand All @@ -116,7 +116,7 @@ func (p *SpeechSynthesizerFriendlyPrompter) MultiSelect(prompt string, defaults
return result[:mid], nil
}

func (p *SpeechSynthesizerFriendlyPrompter) Input(prompt, defaultValue string) (string, error) {
func (p *speechSynthesizerFriendlyPrompter) Input(prompt, defaultValue string) (string, error) {
result := defaultValue
form := p.newForm(
huh.NewGroup(
Expand All @@ -130,7 +130,7 @@ func (p *SpeechSynthesizerFriendlyPrompter) Input(prompt, defaultValue string) (
return result, err
}

func (p *SpeechSynthesizerFriendlyPrompter) Password(prompt string) (string, error) {
func (p *speechSynthesizerFriendlyPrompter) Password(prompt string) (string, error) {
var result string
form := p.newForm(
huh.NewGroup(
Expand All @@ -146,7 +146,7 @@ func (p *SpeechSynthesizerFriendlyPrompter) Password(prompt string) (string, err
return result, err
}

func (p *SpeechSynthesizerFriendlyPrompter) Confirm(prompt string, _ bool) (bool, error) {
func (p *speechSynthesizerFriendlyPrompter) Confirm(prompt string, _ bool) (bool, error) {
var result bool
form := p.newForm(
huh.NewGroup(
Expand All @@ -161,7 +161,7 @@ func (p *SpeechSynthesizerFriendlyPrompter) Confirm(prompt string, _ bool) (bool
return result, nil
}

func (p *SpeechSynthesizerFriendlyPrompter) AuthToken() (string, error) {
func (p *speechSynthesizerFriendlyPrompter) AuthToken() (string, error) {
var result string
form := p.newForm(
huh.NewGroup(
Expand All @@ -183,7 +183,7 @@ func (p *SpeechSynthesizerFriendlyPrompter) AuthToken() (string, error) {
return result, err
}

func (p *SpeechSynthesizerFriendlyPrompter) ConfirmDeletion(requiredValue string) error {
func (p *speechSynthesizerFriendlyPrompter) ConfirmDeletion(requiredValue string) error {
var result string
Comment thread
BagToad marked this conversation as resolved.
Outdated
form := p.newForm(
huh.NewGroup(
Expand All @@ -204,7 +204,7 @@ func (p *SpeechSynthesizerFriendlyPrompter) ConfirmDeletion(requiredValue string
return form.Run()
}

func (p *SpeechSynthesizerFriendlyPrompter) InputHostname() (string, error) {
func (p *speechSynthesizerFriendlyPrompter) InputHostname() (string, error) {
var result string
form := p.newForm(
huh.NewGroup(
Expand All @@ -219,7 +219,7 @@ func (p *SpeechSynthesizerFriendlyPrompter) InputHostname() (string, error) {
return result, err
}
Comment thread
BagToad marked this conversation as resolved.

func (p *SpeechSynthesizerFriendlyPrompter) MarkdownEditor(prompt, defaultValue string, blankAllowed bool) (string, error) {
func (p *speechSynthesizerFriendlyPrompter) MarkdownEditor(prompt, defaultValue string, blankAllowed bool) (string, error) {
var result string
options := []huh.Option[string]{
huh.NewOption("Open Editor", "open"),
Expand Down
Loading
Loading