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

Add support for leading spaces in search pattern #199

Open
sanderr opened this issue Feb 18, 2021 · 8 comments · May be fixed by #261
Open

Add support for leading spaces in search pattern #199

sanderr opened this issue Feb 18, 2021 · 8 comments · May be fixed by #261

Comments

@sanderr
Copy link

sanderr commented Feb 18, 2021

Leading spaces are currently trimmed from the search pattern. I believe this is inherent in the library used to parse the config file. Since this effectively makes bumpversion unusable for any projects that need a search pattern with leading spaces, I think it would be valuable to add space (and potentially tab) to the special character context so it can be used similarly to {#}.

@florisla
Copy link
Collaborator

I think this makes sense. Where did you find out about {#}? I was not familiar with that.

@sanderr
Copy link
Author

sanderr commented Feb 18, 2021

I found out about it by digging into the code when I was trying to find out the strange behavior that resulted in #198. See here.

@florisla
Copy link
Collaborator

We should document this in the README too.

What keywords do we use for space and tab? Simply {space} and {tab}?

@sanderr
Copy link
Author

sanderr commented Feb 19, 2021

I agree documenting this would be a good idea. I believe there were some other things I didn't find in the README but I didn't think to write them down. I'll create another ticket if it comes to mind.

I like {space} and {tab}, I think they clearly convey the intention.

@jaap3
Copy link
Contributor

jaap3 commented Aug 26, 2021

I was trying to achieve the same thing. I'm using bumpversion to bump the version in a package(-lock).json and both the search and replace patterns need to be prefixed by two spaces (and include newlines). Limited (and undocumented) special character handling was added in PR #135, it would be nice if this was expanded to include whitespace characters.

@hukkin
Copy link

hukkin commented Aug 26, 2021

I think just like #221 this would most conveniently be fixed by allowing configuration in a .bumpversion.toml file, as TOML allows strings with leading and trailing whitespace.

@florisla
Copy link
Collaborator

TOML support is discussed in #42. But I think this approach is simpler, and thus could end up being release sooner too.

@kdeldycke
Copy link
Contributor

This issue has been solved by bump-my-version thanks to its transition to TOML-based configuration files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants