A very fast implementation of tldr in Rust. https://tealdeer-rs.github.io/tealdeer/
  • Rust 94.5%
  • Dockerfile 3.7%
  • Shell 1.8%
Find a file
2018-09-16 00:41:58 +02:00
.circleci Switch to CircleCI 2017-12-23 01:51:16 +01:00
src Change default styling 2018-09-16 00:41:58 +02:00
tests Change default styling 2018-09-16 00:41:58 +02:00
.editorconfig Add .editorconfig 2016-01-27 17:48:43 +01:00
.gitignore release-build.sh: Strip binaries 2018-02-27 23:27:19 +01:00
.travis.yml CI: Add macOS testing with Travis 2018-02-11 14:25:06 +01:00
bash_tealdeer Add bash completion (#34) 2018-02-11 00:53:55 +01:00
Cargo.lock Add syntax config support 2018-09-16 00:40:25 +02:00
Cargo.toml Add syntax config support 2018-09-16 00:40:25 +02:00
CHANGELOG.md Version bump to 1.0.0 2018-02-11 01:52:16 +01:00
deer.png Rename project (#26) 2016-04-16 10:20:16 +02:00
deer.svg Rename project (#26) 2016-04-16 10:20:16 +02:00
LICENSE-APACHE License under MIT/Apache-2.0 2016-01-27 17:48:43 +01:00
LICENSE-MIT Bump copyright year 2018-02-11 00:58:53 +01:00
README.md Improve README 2018-09-16 00:41:58 +02:00
release-build.sh release-build.sh: Strip binaries 2018-02-27 23:27:19 +01:00
screenshot-custom.png Add syntax config support 2018-09-16 00:40:25 +02:00
screenshot-default.png Add syntax config support 2018-09-16 00:40:25 +02:00

tealdeer

teal deer

Crate Linux macOS
Crates.io Circle CI Travis CI

A very fast implementation of tldr in Rust: Simplified, example based and community-driven man pages.

screenshot

If you pronounce "tldr" in English, it sounds somewhat like "tealdeer". Hence the project name :)

In case you're in a hurry and just want to quickly try tealdeer, you can find static binaries on the GitHub releases page!

Goals

High level project goals:

  • Download and cache pages
  • Don't require a network connection for anything besides updating the cache
  • Command line interface similar or equivalent to the NodeJS client
  • Be fast

A tool like tldr should be as frictionless as possible to use. It should be easy to invoke (just tldr tar, not using another subcommand like tldr find tar) and it should show the output as fast as possible.

tealdeer reaches these goals. During a (highly non-scientific) test (see #38 for details), I tested the invocation speed of tldr <command> for a few of the existing clients:

Client Times (ms) Avg of 5 (ms)
Tealdeer 15/11/5/5/11 9.4
C client 11/5/12/11/15 10.8
Bash client 15/19/22/25/24 21.0
Go client by k3mist 98/96/100/95/101 98.8
Python client 152/148/151/158/140 149.8
NodeJS client 169/171/170/170/170 170.0

tealdeer was the winner here, although the C client and the Bash client are in the same speed class. Interpreted languages are clearly much slower to invoke, a delay of 170 milliseconds is definitely noticeable and increases friction for the user.

These are the clients I tried but failed to compile or run: Haskell client, Ruby client, Perl client, Go client by anoopengineer, PHP client.

Usage

tldr [options] <command>
tldr [options]

Options:

    -h --help            Show this screen
    -v --version         Show version information
    -l --list            List all commands in the cache
    -f --render <file>   Render a specific markdown file
    -o --os <type>       Override the operating system [linux, osx, sunos]
    -u --update          Update the local cache
    -c --clear-cache     Clear the local cache
    --config-path        Show config directory path
    --seed-config        Create a basic config

Examples:

    $ tldr tar
    $ tldr --list

To control the cache:

    $ tldr --update
    $ tldr --clear-cache

To render a local file (for testing):

    $ tldr --render /path/to/file.md

Installing

Static Binaries (Linux)

Static binary builds (currently for Linux only) are available on the GitHub releases page. Simply download the binary for your platform and run it!

Builds for other platforms are planned.

Cargo Install (any platform)

Build and install the tool via cargo...

$ cargo install tealdeer

From Source (any platform)

tealdeer requires at least Rust 1.19.

Debug build with logging enabled:

$ cargo build --features logging

Release build without logging:

$ cargo build --release

To enable the log output, set the RUST_LOG env variable:

$ export RUST_LOG=tldr=debug

From AUR (Arch Linux)

If you're an Arch Linux user, you can also install the package from the AUR:

Configuration

The tldr command can be customized with a config file called config.toml. Creating the config file can be done manually or with the help of tldr:

$ tldr --seed-config

The command should print the location where the command created the config file. Alternatively the path can also be queried:

$ tldr --config-path

Style

Using the config file, the style (e.g. colors or underlines) can be customized.

Possible styles:

  • description: The initial description text
  • command_name: The command name as part of the example code
  • example_text: The text that describes an example
  • example_code: The example itself, except the command_name and example_variable
  • example_variable: The variables in the example

Currently supported attributes:

  • foreground (color string, see below)
  • background (color string, see below)
  • underline (true or false)
  • bold (true or false)

The currently supported colors are:

  • black
  • red
  • green
  • yellow
  • blue
  • purple
  • cyan
  • white

Example customization: screenshot

Bash Autocompletion

To get bash autocompletion, simply rename the file bash_tealdeer to tldr and copy it to /usr/share/bash-completion/completions/tldr.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Thanks to @SShrike for coming up with the name "tealdeer"!