Bug fixes and readme

dev
Andrew Cassidy 3 years ago
parent 0bf63f1501
commit a3ad83ec32

@ -4,10 +4,19 @@ All notable changes to this project will be documented in this file
## Unreleased
### Added
- Readme file now has installation and usage instructions
- yaclog command entry point added to setup.cfg
### Changed
- `release -c` will no longer create empty commits, and will use the current commit instead
### Fixed
- `release` and `entry` commands now work using empty changelogs
## 0.3.1 - 2021-04-24
### Added

@ -3,4 +3,71 @@ Yet another changelog command line tool
![a yak who is a log](https://github.com/drewcassidy/yaclog/raw/main/logo.png)
*Logo by Erin Cassidy*
*Logo by Erin Cassidy*
## Installation
Install and update using [pip](https://pip.pypa.io/en/stable/quickstart/):
```shell
$ pip install -U yaclog
```
## Usage
For usage from the command line, yaclog provides the `yaclog` command:
```
Usage: yaclog [OPTIONS] COMMAND [ARGS]...
Manipulate markdown changelog files.
Options:
--path FILE Location of the changelog file. [default: CHANGELOG.md]
--version Show the version and exit.
--help Show this message and exit.
Commands:
entry Add entries to the changelog.
format Reformat the changelog file.
init Create a new changelog file.
release Release versions.
show Show changes from the changelog file
tag Modify version tags
```
### Example workflow
Create a new changelog:
```shell
$ yaclog init
```
Add some new entries to the "Added" section of the current unreleased version:
```shell
$ yaclog entry -b 'Introduced some more bugs'
$ yaclog entry -b 'Introduced some more features'
```
Show the current version:
```shell
$ yaclog show
```
```
Unreleased
- Introduced some more bugs
- Introduced some more features
```
Release the current version and make a git tag for it
```shell
$ yaclog release --version 0.0.1 -c
```
```
Renamed version "Unreleased" to "0.0.1".
Commit and create tag for version 0.0.1? [y/N]: y
Created commit a7b6789
Created tag "0.0.1".
```

@ -33,3 +33,7 @@ install_requires =
packaging >= 20
python_requires = >= 3.8
packages = find:
[options.entry_points]
console_scripts =
yaclog = yaclog.cli.__main__:cli

@ -139,10 +139,12 @@ def entry(obj: Changelog, bullets, paragraphs, section_name, version_name):
raise click.BadArgumentUsage(f'Version "{version_name}" not found in changelog.')
version = matches[0]
else:
version = obj.versions[0]
if version.name.lower() != 'unreleased':
matches = [v for v in obj.versions if v.name.lower() == 'unreleased']
if len(matches) == 0:
version = yaclog.changelog.VersionEntry()
obj.versions.insert(0, version)
else:
version = matches[0]
if section_name not in version.sections.keys():
version.sections[section_name] = []
@ -167,7 +169,7 @@ def entry(obj: Changelog, bullets, paragraphs, section_name, version_name):
obj.write()
@cli.command()
@cli.command(short_help='Release versions.')
@click.option('-v', '--version', 'v_flag', type=str, default=None, help='The new version number to use.')
@click.option('-M', '--major', 'v_flag', flag_value='+M', help='Increment major version number.')
@click.option('-m', '--minor', 'v_flag', flag_value='+m', help='Increment minor version number.')

Loading…
Cancel
Save