Skip to content
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

Idea: simplify search patterns configuration #85

Open
dmerejkowsky opened this issue Feb 13, 2021 · 2 comments
Open

Idea: simplify search patterns configuration #85

dmerejkowsky opened this issue Feb 13, 2021 · 2 comments

Comments

@dmerejkowsky
Copy link
Collaborator

dmerejkowsky commented Feb 13, 2021

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}"
@abulka
Copy link

abulka commented Jul 7, 2021

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.

@dmerejkowsky
Copy link
Collaborator Author

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 ...

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

2 participants