Skip to content

Commit

Permalink
docs, help formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
aogier committed Feb 26, 2020
1 parent 2a8d82c commit b23ec9f
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 15 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- tests
- a changelog :D

[Unreleased]: https://github.com/aogier/chachacha/compare/v0.1.2...HEAD
[Unreleased]: https://github.com/aogier/chachacha/compare/v0.1.3...HEAD
[0.1.3]: https://github.com/aogier/chachacha/compare/v0.1.2...v0.1.3
[0.1.2]: https://github.com/aogier/chachacha/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/aogier/chachacha/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/aogier/chachacha/releases/tag/v0.1.0
Expand Down
57 changes: 49 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
[![Package version](https://badge.fury.io/py/chachacha.svg)](https://pypi.org/project/chachacha)

Chachacha changes changelogs. This is a tool you can use to keep your changelog tidy,
for now it only supports the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
specification but the tool's architecture is plugin-based so expect other formats
and/or contribute by yourself what matters! Yay!
following the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
specification which is the most implemented plugin at the moment.

## Installation

Expand Down Expand Up @@ -46,6 +45,7 @@ Options:

Commands:
init initialize a new file
config configure changelog options
release release a version
added add an "added" entry
changed add a "changed" entry
Expand All @@ -55,9 +55,11 @@ Commands:
security add a "security" entry
```

Once again please note that KeepAChangelog format is a plugin, and
implementing other formats is planned/expected. KAC format driver heavily
depends on Colin Bounouar's [keepachangelog library](https://github.com/Colin-b/keepachangelog).
So you can *add*, *change*, *deprecate*, *fix*, *remove* and *security
announce* your changes.

KAC format plugin driver heavily depends on Colin Bounouar's
[keepachangelog library](https://github.com/Colin-b/keepachangelog).

Releasing a version is simple as:

Expand All @@ -81,12 +83,48 @@ Where:
* minor: release a minor
* patch: release a patch

Specification on this behaviour is directly taken from [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
Specification follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
thanks to python [semver library](https://python-semver.readthedocs.io/en/latest/).

## Configuration

Starting from 0.1.3, Chachacha supports a small configuration system directly
embedded in the file via a hack on Markdown link syntax. This allow for
a number of features like generating compare history:

```shell
chachacha init

chachacha config git_provider GH
chachacha config repo_name aogier/chachacha
chachacha config tag_template 'v{t}'

chachacha added one feature
chachacha added another feature
chachacha release
chachacha security hole
chachacha added capability
cat CHANGELOG.md


[...]
- another feature

[Unreleased]: https://github.com/aogier/chachacha/compare/v0.0.1...HEAD
[0.0.1]: https://github.com/aogier/chachacha/releases/tag/v0.0.1

[//]: # (C3-1-DKAC-GGH-Raogier/chachacha-Tv{t})
```
Configuration system keys are:

* `git_provider`: a git repo provider driver (supported: `GH` for github.com)
* `repo_name`: repo name + namespace your repo is
* `tag_template`: a tag template which maps release versions with tag names.
Variable `t` will be expanded with the version number.

## Examples

### Start a changelog, add entries and then bump it
### Start a changelog, add entries and then release

```shell
chachacha init
Expand Down Expand Up @@ -119,6 +157,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- this is no longer valid
[//]: # (C3-1-DKAC)
```
Now release it:
Expand Down Expand Up @@ -156,4 +195,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Deprecated

- this is no longer valid

[//]: # (C3-1-DKAC)
```
4 changes: 1 addition & 3 deletions chachacha/drivers/kac.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ def _write(self, *, current: dict = None, config: Configuration = None) -> None:
# TODO: will decouple
try:
if config.git_provider == "GH":
git_provider = github.Provider(
keepachangelog.to_dict(self.filename), config
)
git_provider = github.Provider(current, config)
ctx["git_provider"] = git_provider
except:
pass
Expand Down
4 changes: 2 additions & 2 deletions chachacha/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ def list_commands_for_help(self, ctx):
commands = (
command
for command in super().list_commands(ctx)
if command not in ("init", "release")
if command not in ("init", "release", "config")
)

return ["init", "release"] + sorted(commands)
return ["init", "config", "release"] + sorted(commands)


@click.group(cls=CCCGroup)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_changelog_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def test_github_provider(tmp_path):
- a changelog entry string
- a changelog entry string
[Unreleased]: https://github.com/aogier/chachacha/compare/v2.0.0...HEAD
[Unreleased]: https://github.com/aogier/chachacha/compare/v3.0.0...HEAD
[3.0.0]: https://github.com/aogier/chachacha/compare/v2.0.0...v3.0.0
[2.0.0]: https://github.com/aogier/chachacha/compare/v1.0.0...v2.0.0
[1.0.0]: https://github.com/aogier/chachacha/releases/tag/v1.0.0
Expand Down

0 comments on commit b23ec9f

Please sign in to comment.