Skip to content

Commit

Permalink
format version parts
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilias Kyrlies committed Jun 24, 2023
1 parent f4e0334 commit ee43bdb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bumpversion/version_part.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ def is_independent(self) -> bool:
return self.config.independent

def __format__(self, format_spec: str) -> str:
return self.value
try:
val = int(self.value)
except ValueError:
return self.value
else:
return int.__format__(val, format_spec)

def __repr__(self) -> str:
return f"<bumpversion.VersionPart:{self.func.__class__.__name__}:{self.value}>"
Expand Down

0 comments on commit ee43bdb

Please sign in to comment.