-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Fix #21789 : CLI Windows autcompletion for ChoiceQuestion function #24716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -114,7 +114,7 @@ public function doAsk(OutputInterface $output, Question $question) | |||
$inputStream = $this->inputStream ?: STDIN; | |||
$autocomplete = $question->getAutocompleterValues(); | |||
|
|||
if (null === $autocomplete || !$this->hasSttyAvailable()) { | |||
if ((null === $autocomplete || self::OS_WIN == $this->getOSTerminal()) || !$this->hasSttyAvailable()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding new const + public method is a new feature.
Here, it's not needed, just do as we do everywhere else: '\\' === \DIRECTORY_SEPARATOR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or use a private method here instead of putting this in the base Helper class
Note that tests are failing with this change. Status: needs work |
Thx @nicolas-grekas for your comment. I've read more information and I dont know if this behavior is caused by OS or by shell version (like git bash - not working, or cygwin). Have u got any suggestion or idea on that ? |
public function getOSTerminal() | ||
{ | ||
switch (true) { | ||
case stristr(PHP_OS, 'DAR'): return self::OS_OSX; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this code gonna survive as private method:
PHP_OS_FAMILY
could be better choice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On PHP 5.3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't Sf use it's own polyfill ?
Hello, 6 months later my question is : Can we say autocompletion does not work on Windows prompt ? (Gitbash & co ? ) If that is the case, can we afford add one requirement in Test class ? Like in QuestionHelperTest line 197 to exclude autocompletion test in Windows environment ? I dont know if it's leggit in PR practices & fix strategy ? |
Instead of working around in some adhoc way, I'd suggest this should be not autocompleted on any platform. See #26875 |
Replaced by #26875 |
[Console] fixed ChoiceQuestion behavior for Win CLI
WIP :
[ ] Unit test break
This PR change CLI Windows behavior for autocompletion in Console->ChoiceQuestion.
In Win CLI you can't see autocompletion so your results can be false if in your choices you've one first symbol (letter or number) equals to your array_keys.
This is described in bug topic.
In this PR, I've just removed autocompletion for Win CLI.