mirror of
https://github.com/drewcassidy/yaclog.git
synced 2024-09-01 14:58:58 +00:00
Compare commits
6 Commits
30947769e1
...
d6da31b6ff
Author | SHA1 | Date | |
---|---|---|---|
d6da31b6ff | |||
d4f477a544 | |||
a392f09a51 | |||
|
683ccbf916 | ||
2a67f6edc7 | |||
c4be5d2420 |
6
.github/workflows/python-publish.yml
vendored
6
.github/workflows/python-publish.yml
vendored
@ -10,13 +10,13 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
|
||||
click-version: [ "click~=7.0", "click~=8.0" ]
|
||||
click-version: [ "click~=8.0" ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5.1.0
|
||||
uses: actions/setup-python@v5.1.1
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
@ -48,7 +48,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5.1.0
|
||||
uses: actions/setup-python@v5.1.1
|
||||
with:
|
||||
python-version: '>=3.8'
|
||||
|
||||
|
11
CHANGELOG.md
11
CHANGELOG.md
@ -2,6 +2,17 @@
|
||||
|
||||
All notable changes to this project will be documented in this file
|
||||
|
||||
## Version 1.3.0 - 2024-08-08
|
||||
|
||||
### Added
|
||||
|
||||
- added a `--version` option to `yaclog show` that prints just the version number
|
||||
|
||||
### Changed
|
||||
|
||||
- removed support for Click 7 as a dependency
|
||||
|
||||
|
||||
## Version 1.2.0 - 2024-04-16
|
||||
|
||||
### Added
|
||||
|
@ -1,7 +1,7 @@
|
||||
[build-system]
|
||||
requires = [
|
||||
"setuptools>=61",
|
||||
"setuptools_scm>=6.2",
|
||||
"setuptools>=64",
|
||||
"setuptools_scm>=8",
|
||||
"wheel"
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
||||
@ -29,7 +29,7 @@ classifiers = [
|
||||
|
||||
requires-python = ">= 3.8"
|
||||
dependencies = [
|
||||
"Click >= 7.0",
|
||||
"Click >= 8.0",
|
||||
"GitPython >= 3",
|
||||
"packaging >= 20",
|
||||
"tomlkit >= 0.11"
|
||||
|
@ -70,6 +70,8 @@ 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. If the current version is unreleased, '
|
||||
'this is inferred by incrementing the patch number of the last released version')
|
||||
@click.argument('version_names', metavar='VERSIONS', type=str, nargs=-1)
|
||||
@click.pass_obj
|
||||
def show(obj: Changelog, all_versions, markdown, mode, version_names):
|
||||
@ -84,15 +86,22 @@ 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]
|
||||
kwargs = {'md': markdown, 'color': True}
|
||||
|
||||
try:
|
||||
if all_versions:
|
||||
versions = obj.versions
|
||||
elif len(version_names) == 0:
|
||||
versions = [obj.current_version()]
|
||||
if mode == 'version' and versions[0].name == 'Unreleased':
|
||||
latest = obj.current_version(released=True).version
|
||||
inferred = yaclog.version.increment_version(str(latest), 2, '')
|
||||
print(str(inferred))
|
||||
return
|
||||
else:
|
||||
versions = [obj.get_version(name) for name in version_names]
|
||||
except KeyError as k:
|
||||
@ -100,8 +109,6 @@ def show(obj: Changelog, all_versions, markdown, mode, version_names):
|
||||
except ValueError as v:
|
||||
raise click.ClickException(str(v))
|
||||
|
||||
kwargs = {'md': markdown, 'color': True}
|
||||
|
||||
sep = '\n\n' if mode == 'body' or mode == 'full' else '\n'
|
||||
click.echo(sep.join([str_func(v, kwargs) for v in versions]))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user