commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

Support optional chars in tag_format depending on if var is set or not

Open hongkongkiwi opened this issue 3 years ago • 3 comments

Description

I would like to have tags such as: v1.0.0-rc1

I can use tag_format: v$major.$minor.$patch-$prerelease but this breaks down if we don't have a prerelease var because an extra dash is added at the end.

According to dogs only v1.0.0rc1 is supported, but that breaks semantic versioning (which I'm using).

Is it possible to add this feature? Or did I miss something and we already have this?

Possible Solution

Allow the use of a bracket to show optional if set, for example in bash you can use: ${prerelease:+"-$prerelease"} which only sets the - if the variable is not empty.

If supporting this, I also recommend to support the opposing which can set a value if the variable is empty: ${prerelease:-"empty"}

To be clear, I don't recommend to support bash expansion, just these two specific use cases in whatever syntax seems appropriate :)

Additional context

No response

Additional context

No response

hongkongkiwi avatar Jun 23 '22 03:06 hongkongkiwi

I'm good with this feature 🙂 @Woile What do you think?

Lee-W avatar Jul 22 '22 15:07 Lee-W

Guys, are you taking in concideration this feature?

It'll be awesome because you can implement more semantic version styling tags for the projects that have to use these kinds of tags, but love commitizen.

sanslash332 avatar Jan 19 '23 05:01 sanslash332

Hi @sanslash332 , yes, I think we agree on this feature. But I don't think we have the bandwidth to work on new features ourselves these days. Our main focus these days is to review / fix / discuss incoming PRs. It'd be really appreciated if you're interested in sending us a PR. Thanks!

Lee-W avatar Jan 19 '23 07:01 Lee-W