-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Cli command chain without interaction #123
Comments
@michalbundyra |
I was looking into it. Here is the original PR: #19 with the chain feature. I do not remember exactly why we did not allow non-interactive mode with chains, but I guess it was due to 'security'. I was checking and we can potentially drop the condition you have noted @sbo-develop, but I believe it would be a BC Break. The other option we can do, we can provide a new configuration option (which will be default to false) something like The other feature might be to introduce one more configuration - to specify a whitelist of the namespaces we allow commands from. Also, current behaviour in non-interactive mode is that we break after first command and do not execute any chained commands. If we change it to run automatically all other commands I believe we should have also an option to "skip chain". Let see the example - we have two commands:
the chain is defined that so now (when it is not possible to run chains in non-interactive mode) we get: bin/laminas first-command --no-interaction will run JUST first-command and it will stop. If we allow chained runs in non-interactive then both commands will be executed. bin/laminas first-command --no-chain --no-interaction And it makes me to the point, that maybe allowing chain in non interactive mode should be a separate argument? bin/laminas first-command --with-chain --no-interaction or even we can implement it as argument with some options (just local command, also 3rd part or whitelisted ...). As the feature seems to be quite nice and easy, I believe we should take it all into consideration to make a right decision. And at the end document it well, so it is easy to use. Now I am on the side that chain should not be called automatically on non-interactive mode, unless user opted-in in the config. Hope it all makes any sense :) |
Very well thought through answer. I‘m with you to have it with opt in and configurable ( former behavior must be kept the same ). An additional parameter with default execute all, except you choose otherwise. |
I've forked it ( https://github.com/sbo-develop/laminas-cli ) and just disabled the stop for chains when in interactive mode, works for me. If i get some advice how to add a new parameter the right way you would like it, i could implement these changes and send a pull request. |
Feature Request
Command chains are not possible to run without interaction. Chains are only available with human interaction. If the input is not interactive, it never executes the chain.
This listener is stopping when the input isn't interactive:
vendor/laminas/laminas-cli/src/Listener/TerminateListener.php
public function __invoke(ConsoleTerminateEvent $event): void { if ($event->getExitCode() !== 0 || ! $event->getInput()->isInteractive()) { // Here it stops when its not interactive return; }
Summary
Execute command chains without interaction, maybe with a --force-chain-execution parameter to not change the past behaviour.
The text was updated successfully, but these errors were encountered: