~reviewer/hello-hut

256ae90371fb816853270f74049afc6ea3e052c1 — Elif Demir 6 months ago 32758a3
docs: describe the configuration file
3 files changed, 41 insertions(+), 0 deletions(-)

M README.md
A docs/configuration.md
M docs/install.md
M README.md => README.md +11 -0
@@ 25,6 25,17 @@ $ hello-hut --time-of-day Grace
Good evening, Grace!
```

## Configuration

Defaults can live in `~/.config/hello-hut/config.toml`:

```toml
name = "Ada"
shout = false
```

Every key is described in [docs/configuration.md](docs/configuration.md).

## License

MIT — see [LICENSE](LICENSE).

A docs/configuration.md => docs/configuration.md +28 -0
@@ 0,0 1,28 @@
# Configuration

hello-hut reads optional defaults from
`$XDG_CONFIG_HOME/hello-hut/config.toml`, falling back to
`~/.config/hello-hut/config.toml`. Options given on the command line always
win over the file.

| Key | Type | Meaning |
| --- | --- | --- |
| `name` | string | Who to greet when no `NAME` is given |
| `shout` | boolean | Shout by default |

Example:

```toml
# ~/.config/hello-hut/config.toml
name = "Ada"
shout = false
```

## Notes

- Reading the file needs Python 3.11 or newer (for `tomllib`); on older
  versions it is ignored.
- Unknown keys are ignored, so you will not recieve an error for a misspelt
  key. Double-check the spelling if a setting seems to have no effect.

See also: [installation](install.md).

M docs/install.md => docs/install.md +2 -0
@@ 21,3 21,5 @@ To try it without installing anything:
```sh
PYTHONPATH=src python3 -m hello_hut Ada
```

Next: [configure hello-hut](configuration.md).