Multiple optional parts in version pattern
jkolaric opened this issue · 1 comments
jkolaric commented
Is there a way of adding multiple optional parts to a version format? For example, if I wanted to make the -TAGNUM
part optional, and also wanted to make PATCH
part optional to escape rollover to zero, what would the version pattern look like?
My configuration looks like this:
[bumpver]
current_version = "21.07.1"
version_pattern = "0Y.0M.PATCH[-TAGNUM]"
commit_message = "Bump version {old_version} -> {new_version}"
commit = false
tag = false
push = false
[bumpver.file_patterns]
"bumpver.toml" = [
'current_version = "{version}"',
]
When I try updating the current version with this configuration, I get an error with message:
Couldn't parse bumpver.toml: Invalid configuration. current_version='21.07.1' is invalid for version_pattern='0Y.0M.[.PATCH][-TAGNUM]'```
Thanks for the help
mbarkhau commented
You have two periods in your pattern. Try this instead.
$ bumpver test "21.07.1" "0Y.0M[.PATCH[-TAGNUM]]"
New Version: 21.08