diff --git a/CHANGELOG.md b/CHANGELOG.md index 34da1a3..da2e2f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/yaclog/cli/__main__.py b/yaclog/cli/__main__.py index 7f85747..baa7d13 100644 --- a/yaclog/cli/__main__.py +++ b/yaclog/cli/__main__.py @@ -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]