Skip to content

Commit

Permalink
feat: infer config file depending on platform with appdirs
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed Aug 21, 2023
1 parent e967745 commit 41964c2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,11 @@ in this particular order:
* `.git-changelog.toml`
* `config/git-changelog.toml`
* `.config/git-changelog.toml`
* `~/.config/git-changelog.toml`
* `<current-user-config-path>/git-changelog.toml`

In the last case (`<current-user-config-path>/git-changelog.toml`), the `<current-user-config-path>`
is platform-dependent and will be automatically inferred from your settings.
In Unix systems, this will typically point at `$HOME/.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`, `off`, `0` or empty string (`''`):
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ classifiers = [
"Typing :: Typed",
]
dependencies = [
"appdirs",
"Jinja2>=2.10,<4",
"semver>=2.13",
"toml>=0.10",
Expand Down
3 changes: 2 additions & 1 deletion src/git_changelog/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from typing import Pattern, TextIO

import toml
from appdirs import user_config_dir
from jinja2.exceptions import TemplateNotFound

from git_changelog import templates
Expand All @@ -42,7 +43,7 @@
".git-changelog.toml",
"config/git-changelog.toml",
".config/git-changelog.toml",
str(Path.home() / ".config" / "git-changelog.toml"),
str(Path(user_config_dir()) / "git-changelog.toml"),
]

DEFAULT_SETTINGS = {
Expand Down

0 comments on commit 41964c2

Please sign in to comment.