Closed wlsyne closed 9 months ago
Is there any method to simulate user pressing down arrow key an enter key
I solved this issue with specifying the Stdio to the Select
func UserSelect() (string, error) {
prompt := promptui.Select{
Label: "Select Day",
Items: []string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday", "Sunday"},
Stdin: os.Stdin,
}
_, result, err := prompt.Run()
if err != nil {
fmt.Printf("Prompt failed %v\n", err)
return "", err
}
fmt.Printf("You choose %q\n", result)
return result, nil
}
I tried to write a unit test of Select but encounterd an error
The function
The test
The error