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
Inconsistency in output of versions for 'show' command #7945
Comments
I do not know if there is a reason for this inconsistency. It does not seem intentional to me, but I could be mistaken. |
Also, as for the last bit of the initial message, is that another issue actually, or is that expected? |
Honestly we do not support using Composer as a library. So I'll refrain from commenting on that. |
👌 pity, because that makes it more difficult to write plugins... Anyway, as for the inconsistency in the output then - do you think it makes sense to open a PR? or wait for more comments? or it's just something nobody cares about? 😅 |
Yeah I can understand that it is a pity. But the amount of questions we would open ourselves up to would just explode exponentially. We already have a hard time keeping up with all the issues and pull requests we receive just for basic Composer usage. @Seldaek do you know if there is a particular reason we use different output formats? @miguelrs I am going to assume for now that there is no reason, so feel free to submit a pull request that makes the output consistent at least (I'd favor the more detailed output -- I am sure you can reduce it to the bare minimum that you need). |
IMO using getFullPrettyVersion makes sense in the outdated listing, because you need to see clearly that there is a commit difference between current and latest in case you are on dev-master already.. In the regular composer show output for a single package, the versions lists all available versions in case of What I see though is that the json format probably should use getPrettyVersion instead of the getFullPrettyVersion, and it possibly should include the full source reference as well for completeness.. but I am not sure how easy a fix that is. |
👌 thanks for the update - I'll try to take a look and make a PR if possible |
TL;DR: See fix needed in bold in #7945 (comment)
My
composer.json
:Output of
composer diagnose
is allOK
.When I run this command:
I get the following output, with 1.3.x-dev as version and dev-master as latest:
However, when I run this command:
I get the following output, with 1.3.x-dev 49fa399 as version and dev-master 40e9ac0 as latest version:
I inspected the code a little bit, and I think the problem is for the first output it's using
getPrettyVersion()
for the current and for the latest version:composer/src/Composer/Command/ShowCommand.php
Line 654 in 19ba2ed
composer/src/Composer/Command/ShowCommand.php
Line 586 in 19ba2ed
However, for the second output it's using
getFullPrettyVersion()
for the current and for the latest version:composer/src/Composer/Command/ShowCommand.php
Line 398 in 19ba2ed
composer/src/Composer/Command/ShowCommand.php
Line 402 in 19ba2ed
Is there a reason for this difference? Couldn't it use
getPrettyVersion()
in both cases?PS: FYI this bothers me because I was writing a test composer plugin where I was parsing the output of
show -D -o -f json
, and when I want to use the versions to find the packages with:it fails to parse the constraint with:
The text was updated successfully, but these errors were encountered: