tbump
tbump copied to clipboard
Idea: simplify search patterns configuration
I got the idea why thinking about #83 and #86
Currently, the syntax is a bit redundant when using a custom version template:
[[file]]
src = "pub.js"
search = "version={current_version}"
version_template="{major}.{minor}"
What if instead, you could just write this?
[[file]]
src = "pub.js"
search = "version={major}.{minor}"
Am just a new user of your package. I think the current syntax is ok because you don't have to understand the implied version template concepts of your proposal, so it's simpler the way it is?
In other words, most of my uses of [[file]] have just src in them, except where it might be tricky, so I add search. Excitingly simple to get up and going. If I had to understand how major/minor blends in, that would be a newbie barrier.
I think you misunderstood my suggestion - sorry about that, I should have been clearer.
Then proposal does not change anything when you're not using search.
The proposal merely replaces the combination of 'search' and 'version_pattern' with just 'search'
Before:
[version]
current = "1.0.0"
regex = '''
(?P<major>\d+)
\.
(?P<minor>\d+)
\.
(?P<patch>\d+)
'''
[[file]]
src = "pub.js"
search = "version={current_version}"
version_template="{major}.{minor}"
After:
[version]
current = "1.0.0"
regex = '''
(?P<major>\d+)
\.
(?P<minor>\d+)
\.
(?P<patch>\d+)
'''
[[file]]
src = "pub.js"
search = "version={major}.{minor}"
But if it's hard to explain, maybe it's not such a good idea after all ...