feat(execute): introduce remote execution command
Ref https://github.com/jolicode/castor/issues/488
This add a new command which allow castor to execute remote package
As an example you could do the following :
castor execute friendsofphp/php-cs-fixer@php-cs-fixer fix --dry-run --diff
Which will
- download the friendsofphp/php-cs-fixer package
- execute the php-cs-fixer binary from it with args
fix --dry-run --diff - remove the package once it has been executed
It could also use a specific version by doing :
castor execute friendsofphp/php-cs-fixer:v3.57.1@php-cs-fixer fix --dry-run --diff
TODO :
- [ ] Tests
- [ ] Documentation
Hi ✋
It sounds pretty cool to run some PHP tools without the need to create a composer.json file 😄
Remove the package once it has been executed.
In certain scenarios, like when working locally, it might be beneficial to retain these packages rather than removing them each time. What do you think about adding an option to prevent the automatic removal of packages?
One idea that comes to mind is for running tools like PHPStan with extensions. It could be useful to provide additional dependencies, such as phpstan/phpstan-symfony
For example, you could execute the following command:
castor execute --deps phpstan/phpstan-symfony phpstan/phpstan@phpstan xxx
This would allow you to easily add the necessary dependencies for specific tools or extensions.
Hello, do you have time to finish this PR?
No problem, i just wasn't sure this is a feature we want ?
I'm not sure I'll use it, but the code is well isolated, so 👍🏼 for me.
See also
- https://github.com/imliam/cpx
- https://github.com/eduardocruz/phpx
ready for review