Merge pull request #237 from dbrgn/improved-docs

Improve docs.

Fixes #235, refs #218.
This commit is contained in:
Danilo Bargen 2021-12-24 21:56:17 +01:00 committed by GitHub
commit bbac67dd29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 91 additions and 24 deletions

View file

@ -4,7 +4,9 @@
- [Installing](./installing.md)
- [Usage](./usage.md)
- [Custom Pages](./usage_custom_pages.md)
- [Configuration](./config.md)
- [display](./config_display.md)
- [style](./config_style.md)
- [updates](./config_updates.md)
- [Section: \[display\]](./config_display.md)
- [Section: \[style\]](./config_style.md)
- [Section: \[updates\]](./config_updates.md)
- [Section: \[directories\]](./config_directories.md)

View file

@ -1,33 +1,30 @@
# Configuration
Tealdeer can be customized with a config file called `config.toml`. Creating
the config file can be done manually or with the help of `tldr`:
Tealdeer can be customized with a config file in [TOML
format](https://toml.io/) called `config.toml`.
$ tldr --seed-config
## Configfile Path
The configuration file path follows OS conventions. It can be queried with the
following command:
The configuration file path follows OS conventions (e.g.
`$XDG_CONFIG_HOME/tealdeer/config.toml` on Linux). The paths can be queried
with the following command:
$ tldr --show-paths
Creating the config file can be done manually or with the help of `tldr`:
$ tldr --seed-config
On Linux, this will usually be `~/.config/tealdeer/config.toml`.
## Override Config Directory
The directory where the configuration file resides may be overwritten by the
environment variable `TEALDEER_CONFIG_DIR`. Remember to use an absolute path.
Variable expansion will not be performed on the path.
## Override Cache Directory
Similarly, the cache directory where the pages are downloaded to, also follows
OS conventions. On Linux, it will usually be at `~/.cache/tealdeer/`. The path
can be overwritten using the environment variable `TEALDEER_CACHE_DIR`.
Remember to use an absolute path. Variable expansion will not be performed on
the path.
## Config Example
Here's an example configuration file. Note that this example does not contain
all possible config options. For details on the things that can be configured,
please refer to the subsections of this documentation page
([display](config_display.html), [style](config_style.html),
[updates](config_updates.html) or [directories](config_directories.html)).
```toml
[display]
compact = false
@ -49,3 +46,17 @@ underline = true
[updates]
auto_update = true
```
## Override Config Directory
The directory where the configuration file resides may be overwritten by the
environment variable `TEALDEER_CONFIG_DIR`. Remember to use an absolute path.
Variable expansion will not be performed on the path.
## Override Cache Directory
Similarly, the cache directory where the pages are downloaded to, also follows
OS conventions. On Linux, it will usually be at `~/.cache/tealdeer/`. The path
can be overwritten using the environment variable `TEALDEER_CACHE_DIR`.
Remember to use an absolute path. Variable expansion will not be performed on
the path.

View file

@ -0,0 +1,12 @@
# Section: \[directories\]
This section allows overriding some directory paths.
## `custom_pages_dir`
Set the directory to be used to look up [custom
pages](usage_custom_pages.html). Remember to use an absolute path. Variable
expansion will not be performed on the path.
[directories]
custom_pages_dir = "/home/myuser/custom-tldr-pages/"

View file

@ -1,4 +1,4 @@
# display
# Section: \[display\]
In the `display` section you can configure the output format.

View file

@ -1,4 +1,4 @@
# style
# Section: \[style\]
Using the config file, the style (e.g. colors or underlines) can be customized.

View file

@ -1,4 +1,4 @@
# updates
# Section: \[updates\]
## Automatic updates

View file

@ -0,0 +1,42 @@
# Custom Pages and Patches
Tealdeer allows creating new custom pages, overriding existing pages as well as
extending existing pages.
The directory, where these custom pages and patches can be placed, follows OS
conventions. On Linux, for example, the default location is
`~/.local/share/tealdeer/pages/`. To print the path used on your system, simply
run `tldr --show-paths`.
The custom pages directory can be [overridden by the config
file](config_directories.html).
## Custom Pages
To document internal command line tools, or if you want to replace an existing
tldr page with one that's better suited for you, place a file with the name
`<command>.page` in the custom pages directory. When calling `tldr <command>`,
your custom page will be shown instead of the upstream version in the cache.
Path:
$CUSTOM_PAGES_DIR/<command>.page
Example:
~/.local/share/tealdeer/pages/ufw.page
## Custom Patches
Sometimes you don't want to fully replace an existing upstream page, but just
want to extend it with your own examples that you frequently need. In this
case, use a file called `<command>.patch`, it will be appended to existing
pages.
Path:
$CUSTOM_PAGES_DIR/<command>.patch
Example:
~/.local/share/tealdeer/pages/ufw.patch