Closed ailisp closed 7 years ago
Hi @ailisp,
Thanks for reporting the issue. What exactly is happening on your setup? What behaviour is inconsistent?
Hi @abinoam Thanks for quick response. In a clone of current master branch. save the content I provide in previous comment as test.rb:
[boyao@new-host highline]$ bundler exec ./test.rb
agree readline=true?aaa
Please enter "yes" or "no".
agree readline=true?
agree readline=true?
Please enter "yes" or "no".
agree readline=true?
agree readline=true?yes
agree readline=false?
aaa
Please enter "yes" or "no".
agree readline=false?
Please enter "yes" or "no".
agree readline=false?
yes
I input aaa
, nothing and yes
for both case (readline=true
or false
), and you can see with readline=true
there's no extra newline after question, but a redundant question.
For choose
, if we have readline=true
then giving an invalid input, the question and menu will both display again, but for readline=false
only question will display again.
I think I understood.
I've had a quick look at the code now and couldn't figure out a quick fix. I'll try to take a look at it next week and try to fix it or at least provide a way to work around it.
👍
I see that the use of readline = true
at agree
is pretty much unimplemented.
It doesn't even autocomplete for yes or no.
Yes. just noticed the auto complete part is not implemented. And here's of some hacks I did for make choose
and agree
looks the same as readline=false
, it works but with some ugly hacks so I don't make a PR here direcly. I think you're more familiar with GNU Readline, but hope this can save you some time.
agree
https://github.com/ManageIQ/manageiq-appliance_console/pull/6/files#diff-11f3fdac8dc445b3e93dd2459f62b9a9choose
, based on a modified ask
, some observations of my experiments are in comments
https://github.com/ManageIQ/manageiq-appliance_console/pull/6/files#diff-70eae34541a813654c1e209ef9e093f4@ailisp Could you please have a look at PR #222 ?
@abinoam Just tested with ask
and choose
, readline=true
works consistently as expected and ompletion also works. Thanks for the fix!
Thank you very much @ailisp! I'll merge it and release it. 👍
Hi, we're using highline in a console for a cloud management platform: https://github.com/manageiq/manageiq-appliance_console. Recently we add all
Highline.ask
withreadline=true
option to add arrow key navigation. It works fine for no validatorask
, but for cases with a validator, likeHighline.agree
orHighline.choose
, it's behavior is inconsistent with the same method call ofreadline=false
option. Though we use a previous version of highline, but I just test with current master branch and inconsistency still exist. For a minimum example, try some invalid input to these twoagree
:Similar problems for
choose
or manually callask
given validator. I did some hacks in our project to make them lo behave the same way asreadline=false
. But I think it's better to fix here.