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

Load cli args before config file #232

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ecs-jnguyen
Copy link

Description

Hi I'm opening this PR to address this issue: #231

I am modifying the configuration loading piece of bump2version so that the cli arguments take precedence over the configurations in the file.

Behavior before pull request Example

Step 1 create .bumpversion.cfg and version.txt

.bumpversion.cfg

[bumpversion]
current_version = 0.8.0
serialize = {major}.{minor}
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+))?

[bumpversion:file:version.txt]

version.txt:

0.8.0

Run bump2version

$ bump2version patch --serialize "{major}.{minor}.{patch}" --list
current_version=0.8.0
serialize={major}.{minor}
parse=(?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+))?
new_version=0.8.1

Results

  • .bumpversion.cfg == 0.8.1
  • version.txt == 0.8

Behavior after changes

[bumpversion]
current_version = 0.8.0
serialize = {major}.{minor}
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+))?

[bumpversion:file:version.txt]

version.txt:

0.8.0

Run bump2version

$ bump2version patch --serialize "{major}.{minor}.{patch}" --list
current_version=0.8.0
serialize={major}.{minor}
parse=(?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+))?
new_version=0.8.1

Results

  • .bumpversion.cfg == 0.8.1
  • version.txt == 0.8.1

@florisla
Copy link
Collaborator

I think this makes sense... We can consider it for the next release.

@florisla florisla added this to the Next release milestone Oct 15, 2021
@florisla florisla self-requested a review October 15, 2021 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants