-
Notifications
You must be signed in to change notification settings - Fork 26
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
Allow commands to auto-complete their own option/argument values #20
Conversation
Maybe the |
f201ecf
to
3561920
Compare
@@ -148,6 +173,10 @@ protected function createHandler($commandLine, $cursorIndex = null) | |||
*/ | |||
protected function getTerms($handlerOutput) | |||
{ | |||
if (null === $handlerOutput) { |
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.
Maybe it's a bug in runCompletion
method it in some cases (maybe when no matching completion handlers were found) it doesn't return anything which results in null
.
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.
It's more of an inconsistency than a bug, but yeah if none of the completion attempts/modes return a value, CompletionHandler::filterResults
is never called and execution reaches the end of the runCompletion
method (here). CompletionHandler::runCompletion
just needs return '';
added at the end to handle that case.
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.
It should return empty array to have consistent output since it returns list of matched entries. If no completion handler was invoked, then 0 results which is equal to empty array.
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.
CompletionHandler::filterResults
and CompletionHandler::runCompletion
currently return strings, but as the returned value ends up being passed to OutputInterface::write
which supports an array, this can be changed to return an array without any functional difference (the tests will just need to be updated).
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.
I've missed that implode statement with \n
. Then sure we need to return a string here.
I'll send another PR about that then.
b912ee4
to
8048d3d
Compare
Requested changes done and all commits squashed. Ready for merge. |
Awesome, thanks @aik099. |
Closes #19