change re.match object to string by grouping the findings together

This commit is contained in:
Semantic Versioner 2019-11-25 13:21:10 -05:00
parent 3175e66426
commit 90bed47a3a

View File

@ -106,7 +106,7 @@ class SemVer(object):
pattern = re.compile("current_version = [0-9.]*")
current_config = re.search(pattern, config_file)
if current_config:
config_file.replace(current_config, "current_version = " + get_tag_version())
config_file.replace(current_config.group(0), "current_version = " + get_tag_version())
else:
config_file.replace("[bumpversion]","[bumpversion]\ncurrent_version = " + get_tag_version())
with open(".bumpversion.cfg", "w") as file: