Skip to content

Commit

Permalink
feat: add configuration files
Browse files Browse the repository at this point in the history
Permit *git-changelog* be configured permanently via config files.

Resolves: pawamoy#54.
  • Loading branch information
oesteban committed Aug 18, 2023
1 parent b3c90af commit ba63ef8
Show file tree
Hide file tree
Showing 2 changed files with 228 additions and 54 deletions.
61 changes: 61 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,67 @@ Other options can be used to help *git-changelog* retrieving
the latest entry from your changelog: `--version-regex`
and `--marker-line`.


## Configuration files

Project-wise, permanent configuration of *git-changelog* is possible.
By default, *git-changelog* will search for the existence a suitable configuration
in the ``pyproject.toml`` file or otherwise, the following configuration files
in this particular order:
* ``.git-changelog.toml``
* ``config/git-changelog.toml``
* ``.config/git-changelog.toml``
* ``~/.config/git-changelog.toml``

The use of a configuration file can be disabled or overridden with the ``--config-file``
option.
To disable the configuration file, pass ``no``, ``None``, ``false``, or ``0``:

```bash
git-changelog --config-file no
```

To override the configuration file, pass the path to the new file:

```bash
git-changelog --config-file $HOME/.custom-git-changelog-config
```

The configuration file must be written in TOML language, and may take values
for most of the command line options:

```toml
bump-latest = false
convention = 'basic'
in-place = false
marker-line = '<!-- insertion marker -->'
output = 'output.log'
parse-refs = false
parse-trailers = false
repository = '.'
sections = ''
template = 'angular'
version-regex = '^## \[(?P<version>v?[^\]]+)'
```

In the case of configuring *git-changelog* within ``pyproject.toml``, these
settings must be found in the appropriate section:

```toml
[tool.git-changelog]
bump-latest = false
convention = 'conventional'
in-place = false
marker-line = '<!-- insertion marker -->'
output = 'output.log'
parse-refs = false
parse-trailers = false
repository = '.'
sections = ''
template = 'keepachangelog'
version-regex = '^## \[(?P<version>v?[^\]]+)'
```

[keepachangelog]: https://keepachangelog.com/en/1.0.0/
[conventional-commit]: https://www.conventionalcommits.org/en/v1.0.0-beta.4/
[jinja]: https://jinja.palletsprojects.com/en/3.1.x/
Expand Down
Loading

0 comments on commit ba63ef8

Please sign in to comment.