ishell
ishell copied to clipboard
Windows Multiplechoice doesn't work
Using master. When using Windows the multiplechoice throws an exception.
func(c *ishell.Context) {
choice := c.MultiChoice([]string{
"Golangers",
"Go programmers",
"Gophers",
"Goers",
}, "What are Go programmers called ?")
if choice == 2 {
c.Println("You got it!")
} else {
c.Println("Sorry, you're wrong.")
}
},
This code will reproduce the problem
Maybe a solution : https://github.com/chzyer/readline/issues/132
I was having same issue on windows and confirm that solution chzyer/readline#132 partially solves the issue ( when replacing all 0 arguments in readline.func(0) with int(os.Stdout.Fd())
So good thing is we have a working choice list on windows.
Remaining issue is that with these changes the select list gets appended on each selection. Example below is a select list with cancel && 2 options, making a couple of selections..
Project list:
> Cancel
[ 1224 ] test
Project list:
Cancel
> [ 1224 ] test
Project list:
Cancel
[ 1224 ] test
Project list:
Cancel
> [ 1224 ] test
Project list:
Cancel
> [ 1224 ] test
[ 1217 ] more test```
Problem here is that windows terminal does not recognise the escape sequences used. I'm looking, but haven't found a decent solution for this issue.