-
Notifications
You must be signed in to change notification settings - Fork 132
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
added option to disable comments in config files #221
Conversation
I think this is a sensible feature to support comment characters. The alternative would be to replace keywords such as This will require a thorough review though. |
I know, that the new option can break config files, when you are using comments as values. As an alternative, it's possible to use a wrapper script: from configparser import ConfigParser, RawConfigParser
from bumpversion.cli import main
@property
def comment_prefixes(self):
return ()
@comment_prefixes.setter
def comment_prefixes(self, value):
pass
RawConfigParser._comment_prefixes = comment_prefixes
ConfigParser._comment_prefixes = comment_prefixes
main() |
An alternative proposal: How about allowing configuration in TOML overcomes this and other flaws of the ini format that lacks specification. |
An added note: tbump (mentioned in RELATED.md uses a EDIT: or perhaps not, haven't used it 😄 the conf structure seems to be different from bumpversion |
I had the same issue but it can be alleviated by using [bumpversion:file (release changes):CHANGELOG.md]
search = ## [Unreleased]
replace = ## [Unreleased]
{#}{#} [{new_version}] - {now:%Y-%m-%d} I found the mention of it in this thread: #199 |
@FredM thanks for the solution, this is the better option to work with markdown files 👍 |
I'm using bum2version to update my changelog. This changelog uses markdown and headers are defined by a multiple of
#
The ConfigParser's default settings is, that
#
and;
are used as comment prefix.This pull request introduces a new command line argument
--disable-config-comments
. When this argument is used, the comment prefixes for the config parser are set toNone
. This allows using#
in multiline search and replace options.Example Changelog:
I want to use bump2version to update
## [Unreleased]
to the current version and the link[Unreleased]: https://github.com/ssh-mitm/ssh-mitm/compare/0.5.12...develop
to match the latest version. bum2version should also add a new unreleased link, so there is no need to add it after a version update.Used config file:
Without disabling the comment prefixes, the line
## [{current_version}] - {now:%Y-%m-%d}
will be removed, because of the#
at the beginning, which will interpreted as comment.When the new argument
--disable-config-comments
is used it works as expected.Updated Changelog: