composer-bin-plugin icon indicating copy to clipboard operation
composer-bin-plugin copied to clipboard

Can outdated command be forwarded as well?

Open hostep opened this issue 2 years ago • 6 comments

Hi there

Thank you very much for this wonderful composer plugin, very happy with it so far!

I've noticed with the forward-command config, that only composer install and composer update are being forwarded to the bin directories. But I sometimes like to run composer outdated as well against everything, and right now I need to do this one by one, which is a bit annoying. Would be nice if this command can also be forwarded.

Thanks for considering this! 🙂

hostep avatar Feb 23 '23 21:02 hostep

That's a good idea. PRs are welcomed! I don't think it requires much more than updating https://github.com/bamarni/composer-bin-plugin/blob/0f2f6f5b69c51333bd8e07d6260d5d975bcab2ae/src/BamarniBinPlugin.php#L36

theofidry avatar Feb 23 '23 22:02 theofidry

Ah cool, good to know. I'll see if I can find some time in the next few days/weeks to test this out and send a PR. Thanks for the info!

hostep avatar Feb 27 '23 19:02 hostep

Just gave it a little try, it's unfortunately a bit more complex. Because composer outdated is more of an alias to composer show --outdated

So adding outdated to the FORWARDED_COMMANDS const does not work. When I add show to it, it does not work with composer outdated, but does work with composer show --outdated. And I can see that composer bin all outdated also does not work.

I haven't debugged further since I lack the time at the moment.

What do you think, should we try to make composer outdated also working somehow? It would be convenient in my opinion.

hostep avatar Mar 06 '23 16:03 hostep

I think we could adapt this condition: https://github.com/bamarni/composer-bin-plugin/blob/0f2f6f5b69c51333bd8e07d6260d5d975bcab2ae/src/BamarniBinPlugin.php#L134

Instead of just checking the in_array we could check if it's the show command with the outdated flag for example. The check could also be extracted into a dedicated method to keep it understandable

theofidry avatar Mar 11 '23 09:03 theofidry

And I can see that composer bin all outdated also does not work.

Yep, for me it checks the first package only :(

LastDragon-ru avatar Jan 29 '24 07:01 LastDragon-ru