Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
update multiselect help text (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecAivazis authored Feb 26, 2020
1 parent dd61e43 commit cc54810
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion multiselect.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var MultiSelectQuestionTemplate = `
{{- color "default+hb"}}{{ .Message }}{{ .FilterMessage }}{{color "reset"}}
{{- if .ShowAnswer}}{{color "cyan"}} {{.Answer}}{{color "reset"}}{{"\n"}}
{{- else }}
{{- " "}}{{- color "cyan"}}[Use arrows to move, enter to select, type to filter{{- if and .Help (not .ShowHelp)}}, {{ .Config.HelpInput }} for more help{{end}}]{{color "reset"}}
{{- " "}}{{- color "cyan"}}[Use arrows to move, space to select, type to filter{{- if and .Help (not .ShowHelp)}}, {{ .Config.HelpInput }} for more help{{end}}]{{color "reset"}}
{{- "\n"}}
{{- range $ix, $option := .PageEntries}}
{{- if eq $ix $.SelectedIndex }}{{color $.Config.Icons.SelectFocus.Format }}{{ $.Config.Icons.SelectFocus.Text }}{{color "reset"}}{{else}} {{end}}
Expand Down
30 changes: 15 additions & 15 deletions multiselect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestMultiSelectRender(t *testing.T) {
},
strings.Join(
[]string{
fmt.Sprintf("%s Pick your words: [Use arrows to move, enter to select, type to filter]", defaultIcons().Question.Text),
fmt.Sprintf("%s Pick your words: [Use arrows to move, space to select, type to filter]", defaultIcons().Question.Text),
fmt.Sprintf(" %s foo", defaultIcons().UnmarkedOption.Text),
fmt.Sprintf(" %s bar", defaultIcons().MarkedOption.Text),
fmt.Sprintf("%s %s baz", defaultIcons().SelectFocus.Text, defaultIcons().UnmarkedOption.Text),
Expand Down Expand Up @@ -81,7 +81,7 @@ func TestMultiSelectRender(t *testing.T) {
},
strings.Join(
[]string{
fmt.Sprintf("%s Pick your words: [Use arrows to move, enter to select, type to filter, %s for more help]", defaultIcons().Question.Text, string(defaultPromptConfig().HelpInput)),
fmt.Sprintf("%s Pick your words: [Use arrows to move, space to select, type to filter, %s for more help]", defaultIcons().Question.Text, string(defaultPromptConfig().HelpInput)),
fmt.Sprintf(" %s foo", defaultIcons().UnmarkedOption.Text),
fmt.Sprintf(" %s bar", defaultIcons().MarkedOption.Text),
fmt.Sprintf("%s %s baz", defaultIcons().SelectFocus.Text, defaultIcons().UnmarkedOption.Text),
Expand All @@ -102,7 +102,7 @@ func TestMultiSelectRender(t *testing.T) {
strings.Join(
[]string{
fmt.Sprintf("%s This is helpful", defaultIcons().Help.Text),
fmt.Sprintf("%s Pick your words: [Use arrows to move, enter to select, type to filter]", defaultIcons().Question.Text),
fmt.Sprintf("%s Pick your words: [Use arrows to move, space to select, type to filter]", defaultIcons().Question.Text),
fmt.Sprintf(" %s foo", defaultIcons().UnmarkedOption.Text),
fmt.Sprintf(" %s bar", defaultIcons().MarkedOption.Text),
fmt.Sprintf("%s %s baz", defaultIcons().SelectFocus.Text, defaultIcons().UnmarkedOption.Text),
Expand All @@ -121,7 +121,7 @@ func TestMultiSelectRender(t *testing.T) {
},
strings.Join(
[]string{
fmt.Sprintf("%s Pick your words: [Use arrows to move, enter to select, type to filter]", defaultIcons().Question.Text),
fmt.Sprintf("%s Pick your words: [Use arrows to move, space to select, type to filter]", defaultIcons().Question.Text),
fmt.Sprintf("%s %s bar", defaultIcons().SelectFocus.Text, defaultIcons().UnmarkedOption.Text),
fmt.Sprintf(" %s baz", defaultIcons().UnmarkedOption.Text),
},
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestMultiSelectPrompt(t *testing.T) {
Options: []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"},
},
func(c *expect.Console) {
c.ExpectString("What days do you prefer: [Use arrows to move, enter to select, type to filter]")
c.ExpectString("What days do you prefer: [Use arrows to move, space to select, type to filter]")
// Select Monday.
c.Send(string(terminal.KeyArrowDown))
c.SendLine(" ")
Expand All @@ -179,7 +179,7 @@ func TestMultiSelectPrompt(t *testing.T) {
Default: []string{"Tuesday", "Thursday"},
},
func(c *expect.Console) {
c.ExpectString("What days do you prefer: [Use arrows to move, enter to select, type to filter]")
c.ExpectString("What days do you prefer: [Use arrows to move, space to select, type to filter]")
c.SendLine("")
c.ExpectEOF()
},
Expand All @@ -196,7 +196,7 @@ func TestMultiSelectPrompt(t *testing.T) {
Default: []int{2, 4},
},
func(c *expect.Console) {
c.ExpectString("What days do you prefer: [Use arrows to move, enter to select, type to filter]")
c.ExpectString("What days do you prefer: [Use arrows to move, space to select, type to filter]")
c.SendLine("")
c.ExpectEOF()
},
Expand All @@ -213,7 +213,7 @@ func TestMultiSelectPrompt(t *testing.T) {
Default: []string{"Tuesday", "Thursday"},
},
func(c *expect.Console) {
c.ExpectString("What days do you prefer: [Use arrows to move, enter to select, type to filter]")
c.ExpectString("What days do you prefer: [Use arrows to move, space to select, type to filter]")
// Deselect Tuesday.
c.Send(string(terminal.KeyArrowDown))
c.Send(string(terminal.KeyArrowDown))
Expand All @@ -230,7 +230,7 @@ func TestMultiSelectPrompt(t *testing.T) {
Help: "Saturday is best",
},
func(c *expect.Console) {
c.ExpectString("What days do you prefer: [Use arrows to move, enter to select, type to filter, ? for more help]")
c.ExpectString("What days do you prefer: [Use arrows to move, space to select, type to filter, ? for more help]")
c.Send("?")
c.ExpectString("Saturday is best")
// Select Saturday
Expand All @@ -248,7 +248,7 @@ func TestMultiSelectPrompt(t *testing.T) {
PageSize: 1,
},
func(c *expect.Console) {
c.ExpectString("What days do you prefer: [Use arrows to move, enter to select, type to filter]")
c.ExpectString("What days do you prefer: [Use arrows to move, space to select, type to filter]")
// Select Monday.
c.Send(string(terminal.KeyArrowDown))
c.SendLine(" ")
Expand All @@ -264,7 +264,7 @@ func TestMultiSelectPrompt(t *testing.T) {
VimMode: true,
},
func(c *expect.Console) {
c.ExpectString("What days do you prefer: [Use arrows to move, enter to select, type to filter]")
c.ExpectString("What days do you prefer: [Use arrows to move, space to select, type to filter]")
// Select Tuesday.
c.Send("jj ")
// Select Thursday.
Expand All @@ -287,7 +287,7 @@ func TestMultiSelectPrompt(t *testing.T) {
Options: []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"},
},
func(c *expect.Console) {
c.ExpectString("What days do you prefer: [Use arrows to move, enter to select, type to filter]")
c.ExpectString("What days do you prefer: [Use arrows to move, space to select, type to filter]")
// Filter down to Tuesday.
c.Send("Tues")
// Select Tuesday.
Expand All @@ -304,7 +304,7 @@ func TestMultiSelectPrompt(t *testing.T) {
Options: []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"},
},
func(c *expect.Console) {
c.ExpectString("What days do you prefer: [Use arrows to move, enter to select, type to filter]")
c.ExpectString("What days do you prefer: [Use arrows to move, space to select, type to filter]")
// Filter down to Tuesday.
c.Send("tues")
// Select Tuesday.
Expand Down Expand Up @@ -341,7 +341,7 @@ func TestMultiSelectPrompt(t *testing.T) {
Options: []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"},
},
func(c *expect.Console) {
c.ExpectString("What days do you prefer: [Use arrows to move, enter to select, type to filter]")
c.ExpectString("What days do you prefer: [Use arrows to move, space to select, type to filter]")
// Filter down to Tuesday.
c.Send("Tues")
// Select Tuesday.
Expand Down Expand Up @@ -373,7 +373,7 @@ func TestMultiSelectPromptKeepFilter(t *testing.T) {
Options: []string{"green", "red", "light-green", "blue", "black", "yellow", "purple"},
},
func(c *expect.Console) {
c.ExpectString("What color do you prefer: [Use arrows to move, enter to select, type to filter]")
c.ExpectString("What color do you prefer: [Use arrows to move, space to select, type to filter]")
// Filter down to green
c.Send("green")
// Select green.
Expand Down

0 comments on commit cc54810

Please sign in to comment.