Fix Input and Choose
This commit is contained in:
parent
6905a01295
commit
ccab29926d
4
input.go
4
input.go
@ -3,7 +3,7 @@ package prompt
|
|||||||
func dummyExecutor(in string) { return }
|
func dummyExecutor(in string) { return }
|
||||||
|
|
||||||
// Input get the input data from the user and return it.
|
// Input get the input data from the user and return it.
|
||||||
func Input(prefix string, completer Completer, opts ...option) string {
|
func Input(prefix string, completer Completer, opts ...Option) string {
|
||||||
pt := New(dummyExecutor, completer)
|
pt := New(dummyExecutor, completer)
|
||||||
pt.renderer.prefixTextColor = DefaultColor
|
pt.renderer.prefixTextColor = DefaultColor
|
||||||
pt.renderer.prefix = prefix
|
pt.renderer.prefix = prefix
|
||||||
@ -17,7 +17,7 @@ func Input(prefix string, completer Completer, opts ...option) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Choose to the shortcut of input function to select from string array.
|
// Choose to the shortcut of input function to select from string array.
|
||||||
func Choose(prefix string, choices []string, opts ...option) string {
|
func Choose(prefix string, choices []string, opts ...Option) string {
|
||||||
completer := newChoiceCompleter(choices, FilterHasPrefix)
|
completer := newChoiceCompleter(choices, FilterHasPrefix)
|
||||||
pt := New(dummyExecutor, completer)
|
pt := New(dummyExecutor, completer)
|
||||||
pt.renderer.prefixTextColor = DefaultColor
|
pt.renderer.prefixTextColor = DefaultColor
|
||||||
|
Loading…
Reference in New Issue
Block a user