add "--version" option to yaclog show

This commit is contained in:
Andrew Cassidy 2024-08-08 00:30:18 -07:00
parent 30947769e1
commit c4be5d2420
2 changed files with 9 additions and 0 deletions

View File

@ -2,6 +2,13 @@
All notable changes to this project will be documented in this file
## Unreleased
### Added
- added a `--version` option to `yaclog show` that prints just the version number
## Version 1.2.0 - 2024-04-16
### Added

View File

@ -70,6 +70,7 @@ def reformat(obj: Changelog):
help='Show only the version body.')
@click.option('--header', '-h', 'mode', flag_value='header',
help='Show only the version header.')
@click.option('--version', '-v', 'mode', flag_value='version', help='Show only the version number.')
@click.argument('version_names', metavar='VERSIONS', type=str, nargs=-1)
@click.pass_obj
def show(obj: Changelog, all_versions, markdown, mode, version_names):
@ -84,6 +85,7 @@ def show(obj: Changelog, all_versions, markdown, mode, version_names):
'name': (lambda v, k: v.name),
'body': (lambda v, k: v.body(**k)),
'header': (lambda v, k: v.header(**k)),
'version': (lambda v, k: str(v.version))
}
str_func = functions[mode]