-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Add post-outdated-cmd and pre-outdated-cmd events #11818
base: main
Are you sure you want to change the base?
Add post-outdated-cmd and pre-outdated-cmd events #11818
Conversation
2342851
to
c5a2778
Compare
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'outdated', $input, $output); | ||
$eventDispatcher = $composer->getEventDispatcher(); | ||
$eventDispatcher->dispatch($commandEvent->getName(), $commandEvent); |
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 orientated by the ArchiveCommand not sure if this additional dispatch is expected or the dispatchScript is enough to be added.
Why not use just the PluginEvents::COMMAND event which fires for every command run?
pre-command-run or command event should do no? |
@Seldaek wanted that it works in all cases the same and is transparent in the composer.json what is happening. As I already use the following post commands already:
|
OK but then it sounds to me like we'd need a more generic solution like the pre-command-run, a post-command-run that fires always after the end of the command? Otherwise you'll add these to every command eventually? :D |
If you have an idea how to implement a general solution I'm also open for that :) The only thing is that we may then not have constants for the pre and post commands if somebody uses them? |
Well have a look where pre-command-run is dispatched in BaseCommand, we could dispatch a post-command-run there as well IMO before returning? |
I use a root composer.json inside my monorepository and forward commands to run in all subpackages. Beside install and update, I would like todo that also for the
outdated
command here: https://github.com/schranz-search/schranz-search/blob/6e84eb2692ea257397d9ebe7b67fce1753cdba98/composer.json#L15So I thought I could add new events to achieve this.
Example Usage:
Let me know what you think about this new events?