Fix release command and empty logs

dev
Andrew Cassidy 3 years ago
parent ec9c785c3a
commit 3972786d82

@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file
- Changelog links dict now contains version links. Modified version links will overwrite those in the table when writing to a file
- Changelog object no longer errors when creating without a path.
- `release` now resets lesser version values when incrementing
- `release` now works with logs that have only unreleased changes
## 0.3.2 - 2021-04-24

@ -181,13 +181,18 @@ def entry(obj: Changelog, bullets, paragraphs, section_name, version_name):
@click.pass_obj
def release(obj: Changelog, v_flag, commit):
"""Release versions in the changelog and increment their version numbers"""
version = [v for v in obj.versions if v.name.lower() != 'unreleased'][0]
matches = [v for v in obj.versions if v.name.lower() != 'unreleased']
if len(matches) == 0:
version = '0.0.0'
else:
version = matches[0].name
cur_version = obj.versions[0]
old_name = cur_version.name
if v_flag:
if v_flag[0] == '+':
new_name = yaclog.cli.version_util.increment_version(version.name, v_flag)
new_name = yaclog.cli.version_util.increment_version(version, v_flag)
else:
new_name = v_flag

Loading…
Cancel
Save