Skip to content

Commit

Permalink
Fix help message for Select (AlecAivazis#219)
Browse files Browse the repository at this point in the history
* Fix help message for Select

Fixes AlecAivazis#218.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>

* Update tests

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
  • Loading branch information
ahmetb authored and AlecAivazis committed Jun 3, 2019
1 parent 102e1c3 commit 887cf34
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion select.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var SelectQuestionTemplate = `
{{- color "default+hb"}}{{ .Message }}{{ .FilterMessage }}{{color "reset"}}
{{- if .ShowAnswer}}{{color "cyan"}} {{.Answer}}{{color "reset"}}{{"\n"}}
{{- else}}
{{- " "}}{{- color "cyan"}}[Use arrows to move, space to select, type to filter{{- if and .Help (not .ShowHelp)}}, {{ HelpInputRune }} for more help{{end}}]{{color "reset"}}
{{- " "}}{{- color "cyan"}}[Use arrows to move, type to filter{{- if and .Help (not .ShowHelp)}}, {{ HelpInputRune }} for more help{{end}}]{{color "reset"}}
{{- "\n"}}
{{- range $ix, $choice := .PageEntries}}
{{- if eq $ix $.SelectedIndex}}{{color "cyan+b"}}{{ SelectFocusIcon }} {{else}}{{color "default+hb"}} {{end}}
Expand Down
6 changes: 3 additions & 3 deletions select_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestSelectRender(t *testing.T) {
SelectTemplateData{SelectedIndex: 2, PageEntries: prompt.Options},
strings.Join(
[]string{
fmt.Sprintf("%s Pick your word: [Use arrows to move, space to select, type to filter]", core.QuestionIcon),
fmt.Sprintf("%s Pick your word: [Use arrows to move, type to filter]", core.QuestionIcon),
" foo",
" bar",
fmt.Sprintf("%s baz", core.SelectFocusIcon),
Expand All @@ -64,7 +64,7 @@ func TestSelectRender(t *testing.T) {
SelectTemplateData{SelectedIndex: 2, PageEntries: prompt.Options},
strings.Join(
[]string{
fmt.Sprintf("%s Pick your word: [Use arrows to move, space to select, type to filter, %s for more help]", core.QuestionIcon, string(core.HelpInputRune)),
fmt.Sprintf("%s Pick your word: [Use arrows to move, type to filter, %s for more help]", core.QuestionIcon, string(core.HelpInputRune)),
" foo",
" bar",
fmt.Sprintf("%s baz", core.SelectFocusIcon),
Expand All @@ -80,7 +80,7 @@ func TestSelectRender(t *testing.T) {
strings.Join(
[]string{
fmt.Sprintf("%s This is helpful", core.HelpIcon),
fmt.Sprintf("%s Pick your word: [Use arrows to move, space to select, type to filter]", core.QuestionIcon),
fmt.Sprintf("%s Pick your word: [Use arrows to move, type to filter]", core.QuestionIcon),
" foo",
" bar",
fmt.Sprintf("%s baz", core.SelectFocusIcon),
Expand Down
2 changes: 1 addition & 1 deletion survey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func TestAsk(t *testing.T) {
c.SendLine("")

// Select
c.ExpectString("Choose a color: [Use arrows to move, space to select, type to filter]")
c.ExpectString("Choose a color: [Use arrows to move, type to filter]")
c.SendLine("yellow")
c.ExpectEOF()
},
Expand Down

0 comments on commit 887cf34

Please sign in to comment.