cargo-edit icon indicating copy to clipboard operation
cargo-edit copied to clipboard

Enhance `cargo set-command` to support custom pre-release identifiers

Open c12i opened this issue 9 months ago • 1 comments

The cargo set-command currently supports bumping pre-releases but is limited to specific values (rc, beta, alpha). However, the SemVer specification does not restrict pre-release identifiers to these specific values.

When using cargo set-command to bump pre-releases, only "rc", "beta", and "alpha" are accepted as valid identifiers.

I would like to propose allowing of custom pre-release identifiers beyond the current hardcoded set, making the command fully compliant with the SemVer specification which allows any valid alphanumeric identifier. I am working on a project where dev is used as an identifier i.e x.x.x-dev.x

What do you think?

c12i avatar Mar 28 '25 08:03 c12i

If by "fully compliant", you mean to support any pre-release field, then we can never be fully compliant. There are unlimited ways that pre-release identifiers can be used and we cannot work to operate on all of them. So the question is what constraints are we willing to put on them to support them.

major, minor, patch bump specific fields in a version. alpha, beta, and rc operate in a different way, adding an identifier if its needed, changing the identifier if its needed, or else bumping the version within the identifier. We don't have a way to bump specific fields (identifer vs version within the identifier). One simple change we could make to better support custom identifiers is we we provide a bump level for just the pre-release version. We could even make this work with any pre-release field setup so long as a number is in the last field. The main challenge with that is coming up with a relevant name that is clear and concise, particularly if we consider adding a pre-release identifier bump level as well.

For all else, we do offer setting of explicit versions as a way to get behavior we do not directly support.

epage avatar Mar 28 '25 14:03 epage