Skip to content

Consider changing cargo --version to output a proper semver #3046

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

Closed
matklad opened this issue Aug 26, 2016 · 4 comments
Closed

Consider changing cargo --version to output a proper semver #3046

matklad opened this issue Aug 26, 2016 · 4 comments

Comments

@matklad
Copy link
Member

matklad commented Aug 26, 2016

cargo --version does a wonderful job providing a human readable version, however its output format is not standardized anywhere and may be difficult to parse programmatically.

Perhaps we should introduce something like cargo version --semver which outputs a string strictly adhering to semver standard (major.minor.patch-release+build.meta)?

$ cargo version --semver
 0.11.0-nightly+259324c.2016-05-20

http://semver.org/

@alexcrichton
Copy link
Member

cc @brson

We'd probably want to mirror this change to rustc as well if we were to land it, but seems reasonable to me

@matklad
Copy link
Member Author

matklad commented Aug 26, 2016

And also for rustup.

@brson
Copy link
Contributor

brson commented Aug 29, 2016

Agree it should be done across all tools, using the same switch, so maybe like --v-semver, or --semversion.

We could also just tack the build metadata onto the existing reported version, which is already semver (if you parse it out), at the risk that existing tools would not understand it (I suspect this wouldn't work for that reason).

But for multiple reasons this doesn't strike me as particularly important: tools will need to continue understanding the existing format for back-compat; the extra metadata isn't all that important.

If we were to do this we might want to consider fixing the confusing distinction between the commit date and build date as well, though that requires changes to the release build process.

@carols10cents
Copy link
Member

I don't believe this is an issue anymore, since cargo --version now outputs text such as:

  • cargo 0.21.0 (5b4b8b2ae 2017-08-12)
  • cargo 0.22.0-beta (3d3f2c05d 2017-08-27)
  • cargo 0.23.0-nightly (8118b02ac 2017-09-14)

and the second parts of these look like valid semver to me. Please reopen if I'm mistaken!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants