Closed aik099 closed 9 years ago
This would be good to have. Happy to accept a PR.
The other default command, list
, has an optional namespace
argument if you wanted to add a built-in completion for that at the same time.
White trying to test this I've stumbled upon a problem. In tests the CompletionHandler::runCompletion
method is used, however, when doing auto-complete from CLI the CompletionCommand::runCompletion
method is used, which also calls the CompletionCommand::configureCompletion
method I've changed.
Because of this I have no way to test that code I've added works.
A few thoughts:
configureCompletion
method on CompletionCommand
getCompletionHandler()
could be added to CompletionCommand
Should these default completions live in CompletionHandler instead of CompletionCommand? I can't decide at the moment.
Ha, you're right. When I added them I was looking as end user, which can only add them to CompletionCommand::configureCompletion
method. But since they are default completion handlers then they should be added in there.
In any case if developer wants to override them he/she can do this by adding completion helper with same arguments.
PR created. No need to immediately create new minor release this time, because I might come up with something else because I'm using this library on one of active projects now.
You can do a release once a month if that's no serious bug of course.
Great, thanks. I'll hold off on doing a release for a while :+1:
There is a built-in
help
command, that accepts other command name (to show help for) as 1st optional argument. No possible argument values are defined in command itself because it's instance is created before all commands were added to application.By adding following to
_completetion
command it will be possible to auto-complete command names forhelp
command:This method is currently empty for
Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand
command.If agreed I can add it to base command or we can just keep it as snippet somewhere in documentation.