A Node.js based command-line client for tldr.
npm install -g tldrIf you have trouble with the post-install script, try the following commands:
npm install -g --ignore-scripts tldr
tldr --updateTo see tldr pages:
tldr <command>show examples for this commandtldr <command> --os=<platform>show command page for the given platform (linux,osx,sunos)tldr --linux <command>show command page for Linuxtldr --osx <command>show command page for OSXtldr --sunos <command>show command page for SunOStldr --listshow all pages for current platformtldr --list-allshow all available pagestldr --randomshow a page at randomtldr --random-exampleshow a single random example
The client caches a copy of all pages locally, in ~/.tldr.
There are more commands to control the local cache:
tldr --updatedownload the latest pagestldr --clear-cachedelete the entire local cache
As a contributor, you might also need the following commands:
tldr --render <path>render a local page for testing purposes
You can configure the tldr client by adding a .tldrrc file in your HOME directory.
This file has to be valid JSON:
{
"colors": {
"text": "green",
"command-background": "black",
"command-foreground": "red",
"command-token": "white"
}
}If you regularly need pages for a different platform (e.g. Linux), you can put it in the config file:
{
"platform": "linux"
}The default platform value can be overwritten with command-line option:
tldr du --os=osxAs a contributor, you can also point to your own fork or branch:
{
"repository" : "myfork/tldr",
// or
"repository" : "myfork/tldr#mybranch",
}Currently we only support command-line autocompletion for zsh. Pull requests for other shells are most welcome!
It's easiest for oh-my-zsh users, so let's start with that.
mkdir -p $ZSH_CUSTOM/tldr
ln -s autocompletion/tldr.zsh $ZSH_CUSTOM/tldr/_tldr
Then add tldr to your oh-my-zsh plugins,
usually defined in ~/.zshrc,
resulting in something looking like this:
plugins=(git tmux tldr)
Fret not regular zsh user!
Copy or symlink autocompletion/tldr.zsh to
my/completions/_tldr
(note the filename).
Then add the containing directory to your fpath:
fpath = (my/completions $fpath)
Colors can't be shown under Mintty or PuTTY, because the dependency colors.js has a bug.
Please show support to this pull request, so it can be merged.
Meanwhile, you can do one of the following to fix this issue:
- Add the following script to your shell's rc file (
.zshrc,.bashrc, etc.): (RECOMMENDED)
tldr_path="$(which tldr)"
function tldr() {
eval "$tldr_path" $@ "--color"
}- Add
alias tldr="tldr --color=true"to your shell's rc file. - Prepend
process.stdout.isTTY = true;totldr.js(NOT RECOMMENDED) - Fix
colors.js's logic (NOT RECOMMENDED)- Go to
%appdata%\npm\node_modules\tldr\node_modules\colors\lib\system\ - Overwrite
supports-colors.jswith supports-colors.js from my repo.
- Go to
- Use
CMD.exe.
Contribution are most welcome! Have a look over here for a few rough guidelines.

