Skip to content

Commit 94bbd26

Browse files
committed
fix(prompter): rename huhprompter
1 parent f7de9e0 commit 94bbd26

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

internal/prompter/prompter.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func New(editorCmd string, stdin ghPrompter.FileReader, stdout ghPrompter.FileWr
4141
editorCmd: editorCmd,
4242
}
4343
default:
44-
return &huhPrompter{
44+
return &SpeechSynthesizerFriendlyPrompter{
4545
stdin: stdin,
4646
stdout: stdout,
4747
stderr: stderr,
@@ -51,7 +51,7 @@ func New(editorCmd string, stdin ghPrompter.FileReader, stdout ghPrompter.FileWr
5151
}
5252
}
5353

54-
type huhPrompter struct {
54+
type SpeechSynthesizerFriendlyPrompter struct {
5555
stdin ghPrompter.FileReader
5656
stdout ghPrompter.FileWriter
5757
stderr ghPrompter.FileWriter
@@ -60,18 +60,18 @@ type huhPrompter struct {
6060
}
6161

6262
// IsAccessible returns true if the huhPrompter was created in accessible mode.
63-
func (p *huhPrompter) IsAccessible() bool {
63+
func (p *SpeechSynthesizerFriendlyPrompter) IsAccessible() bool {
6464
return p.accessible
6565
}
6666

67-
func (p *huhPrompter) newForm(groups ...*huh.Group) *huh.Form {
67+
func (p *SpeechSynthesizerFriendlyPrompter) newForm(groups ...*huh.Group) *huh.Form {
6868
return huh.NewForm(groups...).
6969
WithTheme(huh.ThemeBase16()).
7070
WithAccessible(p.accessible).
7171
WithProgramOptions(tea.WithOutput(p.stdout), tea.WithInput(p.stdin))
7272
}
7373

74-
func (p *huhPrompter) Select(prompt, _ string, options []string) (int, error) {
74+
func (p *SpeechSynthesizerFriendlyPrompter) Select(prompt, _ string, options []string) (int, error) {
7575
var result int
7676
formOptions := []huh.Option[int]{}
7777
for i, o := range options {
@@ -91,7 +91,7 @@ func (p *huhPrompter) Select(prompt, _ string, options []string) (int, error) {
9191
return result, err
9292
}
9393

94-
func (p *huhPrompter) MultiSelect(prompt string, defaults []string, options []string) ([]int, error) {
94+
func (p *SpeechSynthesizerFriendlyPrompter) MultiSelect(prompt string, defaults []string, options []string) ([]int, error) {
9595
var result []int
9696
formOptions := make([]huh.Option[int], len(options))
9797
for i, o := range options {
@@ -116,7 +116,7 @@ func (p *huhPrompter) MultiSelect(prompt string, defaults []string, options []st
116116
return result[:mid], nil
117117
}
118118

119-
func (p *huhPrompter) Input(prompt, defaultValue string) (string, error) {
119+
func (p *SpeechSynthesizerFriendlyPrompter) Input(prompt, defaultValue string) (string, error) {
120120
result := defaultValue
121121
form := p.newForm(
122122
huh.NewGroup(
@@ -130,7 +130,7 @@ func (p *huhPrompter) Input(prompt, defaultValue string) (string, error) {
130130
return result, err
131131
}
132132

133-
func (p *huhPrompter) Password(prompt string) (string, error) {
133+
func (p *SpeechSynthesizerFriendlyPrompter) Password(prompt string) (string, error) {
134134
var result string
135135
form := p.newForm(
136136
huh.NewGroup(
@@ -146,7 +146,7 @@ func (p *huhPrompter) Password(prompt string) (string, error) {
146146
return result, err
147147
}
148148

149-
func (p *huhPrompter) Confirm(prompt string, _ bool) (bool, error) {
149+
func (p *SpeechSynthesizerFriendlyPrompter) Confirm(prompt string, _ bool) (bool, error) {
150150
var result bool
151151
form := p.newForm(
152152
huh.NewGroup(
@@ -161,7 +161,7 @@ func (p *huhPrompter) Confirm(prompt string, _ bool) (bool, error) {
161161
return result, nil
162162
}
163163

164-
func (p *huhPrompter) AuthToken() (string, error) {
164+
func (p *SpeechSynthesizerFriendlyPrompter) AuthToken() (string, error) {
165165
var result string
166166
form := p.newForm(
167167
huh.NewGroup(
@@ -183,7 +183,7 @@ func (p *huhPrompter) AuthToken() (string, error) {
183183
return result, err
184184
}
185185

186-
func (p *huhPrompter) ConfirmDeletion(requiredValue string) error {
186+
func (p *SpeechSynthesizerFriendlyPrompter) ConfirmDeletion(requiredValue string) error {
187187
var result string
188188
form := p.newForm(
189189
huh.NewGroup(
@@ -204,7 +204,7 @@ func (p *huhPrompter) ConfirmDeletion(requiredValue string) error {
204204
return form.Run()
205205
}
206206

207-
func (p *huhPrompter) InputHostname() (string, error) {
207+
func (p *SpeechSynthesizerFriendlyPrompter) InputHostname() (string, error) {
208208
var result string
209209
form := p.newForm(
210210
huh.NewGroup(
@@ -219,7 +219,7 @@ func (p *huhPrompter) InputHostname() (string, error) {
219219
return result, err
220220
}
221221

222-
func (p *huhPrompter) MarkdownEditor(prompt, defaultValue string, blankAllowed bool) (string, error) {
222+
func (p *SpeechSynthesizerFriendlyPrompter) MarkdownEditor(prompt, defaultValue string, blankAllowed bool) (string, error) {
223223
var result string
224224
options := []huh.Option[string]{
225225
huh.NewOption("Open Editor", "open"),

internal/prompter/prompter_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ func TestNewReturnsAccessiblePrompter(t *testing.T) {
2828

2929
p := New(editorCmd, stdin, stdout, stderr)
3030

31-
assert.IsType(t, &huhPrompter{}, p, "expected huhPrompter to be returned")
32-
assert.Equal(t, p.(*huhPrompter).IsAccessible(), true, "expected huhPrompter to be accessible")
31+
assert.IsType(t, &SpeechSynthesizerFriendlyPrompter{}, p, "expected huhPrompter to be returned")
32+
assert.Equal(t, p.(*SpeechSynthesizerFriendlyPrompter).IsAccessible(), true, "expected huhPrompter to be accessible")
3333
})
3434

3535
t.Run("returns accessible huhPrompter when GH_SCREENREADER_FRIENDLY is set to 1", func(t *testing.T) {
3636
t.Setenv("GH_SCREENREADER_FRIENDLY", "1")
3737

3838
p := New(editorCmd, stdin, stdout, stderr)
3939

40-
assert.IsType(t, &huhPrompter{}, p, "expected huhPrompter to be returned")
41-
assert.Equal(t, p.(*huhPrompter).IsAccessible(), true, "expected huhPrompter to be accessible")
40+
assert.IsType(t, &SpeechSynthesizerFriendlyPrompter{}, p, "expected huhPrompter to be returned")
41+
assert.Equal(t, p.(*SpeechSynthesizerFriendlyPrompter).IsAccessible(), true, "expected huhPrompter to be accessible")
4242
})
4343

4444
t.Run("returns surveyPrompter when GH_SCREENREADER_FRIENDLY is set to false", func(t *testing.T) {
@@ -87,7 +87,7 @@ func TestAccessibleHuhprompter(t *testing.T) {
8787
require.NoError(t, err)
8888
t.Cleanup(func() { testCloser(t, console) })
8989

90-
p := &huhPrompter{
90+
p := &SpeechSynthesizerFriendlyPrompter{
9191
editorCmd: "", // intentionally empty to cause a failure.
9292
accessible: true,
9393
}

0 commit comments

Comments
 (0)