• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/workflows/H04-Sep-2020-7064

cargo-crates/H03-May-2022-1,693,4031,382,511

src/H04-Sep-2020-1,4251,115

tests/H04-Sep-2020-710510

.editorconfigH A D04-Sep-2020172 1310

.gitattributesH A D04-Sep-202043 53

.gitignoreH A D04-Sep-202043 65

CHANGELOG.mdH A D04-Sep-20206.4 KiB199149

Cargo.lockH A D04-Sep-202041.2 KiB1,6851,505

Cargo.tomlH A D04-Sep-20201.2 KiB4942

LICENSE-APACHEH A D04-Sep-20209.5 KiB177150

LICENSE-MITH A D04-Sep-20201.1 KiB2016

README.mdH A D04-Sep-20209.5 KiB302196

RELEASING.mdH A D04-Sep-2020543 3419

bash_tealdeerH A D04-Sep-2020698 3529

fish_tealdeerH A D04-Sep-20201.2 KiB2521

release-build.shH A D04-Sep-20201.8 KiB7860

zsh_tealdeerH A D04-Sep-20201.3 KiB4438

README.md

1# tealdeer
2
3![teal deer](deer.png)
4
5|Crate|CI (Linux/macOS/Windows)|
6|:---:|:---:|
7|[![Crates.io][crates-io-badge]][crates-io]|[![GitHub CI][github-actions-badge]][github-actions]|
8
9A very fast implementation of [tldr](https://github.com/tldr-pages/tldr) in
10Rust: Simplified, example based and community-driven man pages.
11
12<img src="screenshot-default.png" alt="Screenshot of tldr command" width="600">
13
14If you pronounce "tldr" in English, it sounds somewhat like "tealdeer". Hence the project name :)
15
16In case you're in a hurry and just want to quickly try tealdeer, you can find static
17binaries on the [GitHub releases page](https://github.com/dbrgn/tealdeer/releases/)!
18
19
20## Goals
21
22High level project goals:
23
24- [x] Download and cache pages
25- [x] Don't require a network connection for anything besides updating the cache
26- [x] Command line interface similar or equivalent to the [NodeJS client][tldr-node-client]
27- [x] Be fast
28
29A tool like `tldr` should be as frictionless as possible to use. It should be
30easy to invoke (just `tldr tar`, not using another subcommand like `tldr find
31tar`) and it should show the output as fast as possible.
32
33tealdeer reaches these goals. During a (highly non-scientific) test (see
34[#38](https://github.com/dbrgn/tealdeer/issues/38) for details), I tested the
35invocation speed of `tldr <command>` for a few of the existing clients:
36
37| Client | Times (ms) | Avg of 5 (ms) |
38| --- | --- | --- |
39| [Tealdeer](https://github.com/dbrgn/tealdeer/) | `15/11/5/5/11` | `9.4` (100%) |
40| [C client](https://github.com/tldr-pages/tldr-cpp-client) | `11/5/12/11/15` | `10.8` (115%) |
41| [Bash client](https://github.com/pepa65/tldr-bash-client) | `15/19/22/25/24` | `21.0` (223%) |
42| [Go client by k3mist](https://github.com/k3mist/tldr/) | `98/96/100/95/101` | `98.8` (1'051%) |
43| [Python client](https://github.com/lord63/tldr.py) | `152/148/151/158/140` | `149.8` (1'594%) |
44| [NodeJS client](https://github.com/tldr-pages/tldr-node-client) | `169/171/170/170/170` | `170.0` (1'809%) |
45
46tealdeer was the winner here, although the C client and the Bash client are in
47the same speed class. Interpreted languages are clearly much slower to invoke,
48a delay of 170 milliseconds is definitely noticeable and increases friction for
49the user.
50
51These are the clients I tried but failed to compile or run:
52[Haskell client](https://github.com/psibi/tldr-hs),
53[Ruby client](https://github.com/YellowApple/tldrb),
54[Perl client](https://github.com/skaji/perl-tldr),
55[Go client by anoopengineer](https://github.com/anoopengineer/tldr/),
56[PHP client](https://github.com/BrainMaestro/tldr-php).
57
58
59## Usage
60
61    tldr [options] <command>
62    tldr [options]
63
64    Options:
65
66        -h --help            Show this screen
67        -v --version         Show version information
68        -l --list            List all commands in the cache
69        -f --render <file>   Render a specific markdown file
70        -o --os <type>       Override the operating system [linux, osx, sunos, windows]
71        -u --update          Update the local cache
72        -c --clear-cache     Clear the local cache
73        -p --pager           Use a pager to page output
74        -m --markdown        Display the raw markdown instead of rendering it
75        -q --quiet           Suppress informational messages
76        --config-path        Show config file path
77        --seed-config        Create a basic config
78        --color <when>       Control when to use color [always, auto, never] [default: auto]
79
80    Examples:
81
82        $ tldr tar
83        $ tldr --list
84
85    To control the cache:
86
87        $ tldr --update
88        $ tldr --clear-cache
89
90    To render a local file (for testing):
91
92        $ tldr --render /path/to/file.md
93
94
95## Installing
96
97### Static Binaries (Linux)
98
99Static binary builds (currently for Linux only) are available on the
100[GitHub releases page](https://github.com/dbrgn/tealdeer/releases).
101Simply download the binary for your platform and run it!
102
103Builds for other platforms are planned.
104
105### Cargo Install (any platform)
106
107Build and install the tool via cargo...
108
109    $ cargo install tealdeer
110
111*(Note: You might need to install OpenSSL development headers, otherwise you get
112a "failed to run custom build command for openssl-sys" error message. The
113package is called `libssl-dev` on Ubuntu.)*
114
115### From Package Manager
116
117tealdeer has been added to a few package managers:
118
119- Arch Linux AUR: [`tealdeer`](https://aur.archlinux.org/packages/tealdeer/),
120  [`tealdeer-bin`](https://aur.archlinux.org/packages/tealdeer-bin/) or
121  [`tealdeer-git`](https://aur.archlinux.org/packages/tealdeer-git/)
122- Fedora: [`tealdeer`](https://src.fedoraproject.org/rpms/rust-tealdeer)
123- FreeBSD: [`sysutils/tealdeer`](https://www.freshports.org/sysutils/tealdeer/)
124- macOS Homebrew: [`tealdeer`](https://formulae.brew.sh/formula/tealdeer)
125- NetBSD: [`sysutils/tealdeer`](https://pkgsrc.se/sysutils/tealdeer)
126- Nix: [`tealdeer`](https://nixos.org/nixos/packages.html#tealdeer)
127- openSUSE: [`tealdeer`](https://software.opensuse.org/package/tealdeer?search_term=tealdeer)
128- Solus: [`tealdeer`](https://packages.getsol.us/shannon/t/tealdeer/)
129- Void Linux: [`tealdeer`](https://github.com/void-linux/void-packages/tree/master/srcpkgs/tealdeer)
130
131### From Source (any platform)
132
133tealdeer requires at least Rust 1.39.
134
135Debug build with logging enabled:
136
137    $ cargo build --features logging
138
139Release build without logging:
140
141    $ cargo build --release
142
143To enable the log output, set the `RUST_LOG` env variable:
144
145    $ export RUST_LOG=tldr=debug
146
147
148## Configuration
149
150The tldr command can be customized with a config file called `config.toml`.
151Creating the config file can be done manually or with the help of tldr:
152
153    $ tldr --seed-config
154
155The configuration file path follows OS conventions. It can be queried with the following command:
156
157    $ tldr --config-path
158
159The directory where the configuration file resides may be overwritten by the
160environment variable `TEALDEER_CONFIG_DIR`. Remember to use an absolute path.
161Variable expansion will not be performed on the path.
162
163### Style
164
165Using the config file, the style (e.g. colors or underlines) can be customized.
166
167Possible styles:
168
169- `description`: The initial description text
170- `command_name`: The command name as part of the example code
171- `example_text`: The text that describes an example
172- `example_code`: The example itself, except the `command_name` and `example_variable`
173- `example_variable`: The variables in the example
174
175Currently supported attributes:
176
177- `foreground` (color string, see below)
178- `background` (color string, see below)
179- `underline` (`true` or `false`)
180- `bold` (`true` or `false`)
181
182The currently supported colors are:
183
184- `black`
185- `red`
186- `green`
187- `yellow`
188- `blue`
189- `purple`
190- `cyan`
191- `white`
192
193Example customization:
194
195<img src="screenshot-custom.png" alt="Screenshot of customized version" width="600">
196
197### Display
198
199In the `display` section you can configure the output format.
200
201#### `use_pager`
202
203Specifies whether the pager should be used by default or not (default `false`).
204
205    [display]
206    use_pager = true
207
208When enabled, `less -R` is used as pager. To override the pager command used,
209set the `PAGER` environment variable.
210
211NOTE: This feature is not available on Windows.
212
213#### `compact`
214
215Set this to enforce more compact output, where empty lines are stripped out
216(default `false`).
217
218    [display]
219    compact = true
220
221
222### Automatic updates
223
224tealdeer can refresh the cache automatically when it is outdated. This
225behavior can be configured in the `updates` section and is disabled by
226default.
227
228#### `auto_update`
229
230Specifies whether the auto-update feature should be enabled (defaults to
231`false`).
232
233    [updates]
234    auto_update = true
235
236#### `auto_update_interval_hours`
237
238Duration, since the last cache update, after which the cache will be
239refreshed (defaults to 720 hours). This parameter is ignored if `auto_update`
240is set to `false`.
241
242    [updates]
243    auto_update = true
244    auto_update_interval_hours = 24
245
246
247## Autocompletion
248
249- *Bash*: copy `bash_tealdeer` to `/usr/share/bash-completion/completions/tldr`
250- *Fish*: copy `fish_tealdeer` to `~/.config/fish/completions/tldr.fish`
251- *Zsh*: copy `zsh_tealdeer` to `/usr/share/zsh/site-functions/_tldr`
252
253
254## Development
255
256To run tests:
257
258    $ cargo test
259
260To run lints:
261
262    $ rustup component add clippy
263    $ cargo clean && cargo clippy
264
265
266## MSRV (Minimally Supported Rust Version)
267
268Tealdeer will not bump the MSRV requirement in patch versions, but it may
269increase it in minor versions. The reason is that many important libraries
270(e.g. the Tokio ecosystem, which is a dependency of reqwest, which is used for
271downloading the cache) do not follow a static MSRV, but instead follow a
272"stable + last n releases" approach. Trying to guarantee the same MSRV across
273all minor releases would be a futile attempt.
274
275
276## License
277
278Licensed under either of
279
280 * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
281   http://www.apache.org/licenses/LICENSE-2.0)
282 * MIT license ([LICENSE-MIT](LICENSE-MIT) or
283   http://opensource.org/licenses/MIT) at your option.
284
285
286### Contribution
287
288Unless you explicitly state otherwise, any contribution intentionally submitted
289for inclusion in the work by you, as defined in the Apache-2.0 license, shall
290be dual licensed as above, without any additional terms or conditions.
291
292Thanks to @SShrike for coming up with the name "tealdeer"!
293
294
295[tldr-node-client]: https://github.com/tldr-pages/tldr-node-client
296
297<!-- Badges -->
298[github-actions]: https://github.com/dbrgn/tealdeer/actions?query=branch%3Amaster
299[github-actions-badge]: https://github.com/dbrgn/tealdeer/workflows/CI/badge.svg
300[crates-io]: https://crates.io/crates/tealdeer
301[crates-io-badge]: https://img.shields.io/crates/v/tealdeer.svg
302