{"id":13464868,"url":"https://github.com/tldr-pages/tldr-node-client","last_synced_at":"2025-05-14T16:05:28.418Z","repository":{"id":14630556,"uuid":"17348050","full_name":"tldr-pages/tldr-node-client","owner":"tldr-pages","description":"Node.js command-line client for tldr pages 📚","archived":false,"fork":false,"pushed_at":"2025-03-31T13:08:30.000Z","size":2952,"stargazers_count":450,"open_issues_count":36,"forks_count":75,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-04-12T01:54:48.898Z","etag":null,"topics":["hacktoberfest","javascript","linux","macos","nodejs","tldr","tldr-pages","windows"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/tldr","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tldr-pages.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"liberapay":"tldr-pages"}},"created_at":"2014-03-02T22:02:59.000Z","updated_at":"2025-04-06T01:41:09.000Z","dependencies_parsed_at":"2023-01-12T01:30:26.400Z","dependency_job_id":"d1636b88-5be5-4bf3-b469-ef611ed839f3","html_url":"https://github.com/tldr-pages/tldr-node-client","commit_stats":{"total_commits":484,"total_committers":59,"mean_commits":8.203389830508474,"dds":0.7706611570247934,"last_synced_commit":"60d46738dfbb40b54e616b9b3ffc8e0a509c4b9c"},"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tldr-pages%2Ftldr-node-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tldr-pages%2Ftldr-node-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tldr-pages%2Ftldr-node-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tldr-pages%2Ftldr-node-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tldr-pages","download_url":"https://codeload.github.com/tldr-pages/tldr-node-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505871,"owners_count":21115354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","javascript","linux","macos","nodejs","tldr","tldr-pages","windows"],"created_at":"2024-07-31T14:00:51.934Z","updated_at":"2025-04-12T01:54:58.714Z","avatar_url":"https://github.com/tldr-pages.png","language":"JavaScript","funding_links":["https://liberapay.com/tldr-pages"],"categories":["windows","JavaScript"],"sub_categories":[],"readme":"# tldr-node-client\n\n[![NPM version][npm-image]][npm-url]\n[![GitHub Action Build Status][gh-actions-image]][gh-actions-url]\n[![Matrix chat][matrix-image]][matrix-url]\n\nA `Node.js` based command-line client for [tldr](https://github.com/tldr-pages/tldr).\n\n![tldr screenshot](screenshot.png)\n\n_tldr-node-client's output for the `tar` page, using a custom color theme_\n\n## Installing\n\n```bash\nnpm install -g tldr\n```\n\n## Usage\n\nTo see tldr pages:\n\n- `tldr \u003ccommand\u003e` show examples for this command\n- `tldr \u003ccommand\u003e --platform=\u003cosx, darwin, macos, freebsd, linux, netbsd, openbsd, sunos, android, windows, win32\u003e` show command page for the given platform\n- `tldr --android \u003ccommand\u003e` show command page for Android\n- `tldr --darwin \u003ccommand\u003e` show command page for darwin (macOS)\n- `tldr --freebsd \u003ccommand\u003e` show command page for FreeBSD\n- `tldr --linux \u003ccommand\u003e` show command page for Linux\n- `tldr --macos \u003ccommand\u003e` show command page for macOS\n- `tldr --netbsd \u003ccommand\u003e` show command page for NetBSD\n- `tldr --openbsd \u003ccommand\u003e` show command page for OpenBSD\n- `tldr --osx \u003ccommand\u003e` show command page for osx (macOS)\n- `tldr --sunos \u003ccommand\u003e` show command page for SunOS\n- `tldr --win32 \u003ccommand\u003e` show command page for win32 (Windows)\n- `tldr --windows \u003ccommand\u003e` show command page for Windows\n- `tldr --search \"\u003cquery\u003e\"` search all pages for the query\n- `tldr --list` show all pages for current platform\n- `tldr --list-all` show all available pages\n- `tldr --random` show a page at random\n- `tldr --random-example` show a single random example\n- `tldr --markdown` show the original markdown format page\n\nThe client caches a copy of all pages locally, in `~/.tldr`.\nThere are more commands to control the local cache:\n\n- `tldr --update` download the latest pages and generate search index\n- `tldr --clear-cache` delete the entire local cache\n\nAs a contributor, you might also need the following commands:\n\n- `tldr --render \u003cpath\u003e` render a local page for testing purposes\n\nTldr pages defaults to showing pages in the current language of the operating system, or English if that's not available. To view tldr pages for a different language, set an environment variable `LANG` containing a valid [POSIX locale](https://www.gnu.org/software/gettext/manual/html_node/Locale-Names.html#Locale-Names) (such as `zh`, `pt_BR`, or `fr`) and then run the above commands as usual. In most `*nix` systems, this variable will already be set.\n\nIt is suggested that the `LANG` environment variable be set system-wide if this isn't already the case. Users without `sudo` access can set it locally in their `~/.profile`.\n\n- `LANG=zh tldr \u003ccommand\u003e`\n\nFor the list of available translations, please refer to the main [tldr](https://github.com/tldr-pages/tldr) repo.\n\n## Configuration\n\nYou can configure the `tldr` client by adding a `.tldrrc` file in your HOME directory. You can copy the contents of the `config.json` file from the repo to get the basic structure to start with, and modify it to suit your needs.\n\nThe default color theme is the one named `\"simple\"`. You can change the theme by assigning a different value to the `\"theme\"` variable -- either to one of the pre-configured themes, or to a new theme that you have previously created in the `\"themes\"` section. Note that the colors and text effects you can choose are limited. Refer to the [chalk documentation](https://github.com/chalk/chalk#styles) for all options.\n\n```json\n{\n  \"themes\": {\n    \"ocean\": {\n      \"commandName\": \"bold, cyan\",\n      \"mainDescription\": \"\",\n      \"exampleDescription\": \"green\",\n      \"exampleCode\": \"cyan\",\n      \"exampleToken\": \"dim\"\n    },\n    \"myOwnCoolTheme\": {\n      \"commandName\": \"bold, red\",\n      \"mainDescription\": \"underline\",\n      \"exampleDescription\": \"yellow\",\n      \"exampleCode\": \"underline, green\",\n      \"exampleToken\": \"\"\n    }\n  },\n  \"theme\": \"ocean\"\n}\n```\n\nIf you regularly need pages for a different platform (e.g. Linux),\nyou can put it in the config file:\n\n```json\n{\n  \"platform\": \"linux\"\n}\n```\n\nThe default platform value can be overwritten with command-line option:\n\n```shell\ntldr du --platform=\u003cosx\u003e\n```\n\nAs a contributor, you can also point to your own fork containing the `tldr.zip` file. The file is just a zipped version of the entire tldr repo:\n\n```js\n{\n  \"repository\": \"http://myrepo/assets/tldr.zip\"\n}\n```\n\nBy default, a cache update is performed anytime a page is not found for a command. To prevent this behavior,\nyou can set the configuration variable `skipUpdateWhenPageNotFound` to `true` (defaults to `false`):\n\n```js\n{\n  \"skipUpdateWhenPageNotFound\": true\n}\n```\n\n## Command-line Autocompletion\n\nWe currently support command-line autocompletion for zsh and bash.  \nPull requests for other shells are most welcome!\n\nTo enable autocompletion for the tldr command, run:\n\n### zsh\n\nIt's easiest for\n[oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)\nusers, so let's start with that.\n\n```zsh\nmkdir -p $ZSH_CUSTOM/plugins/tldr\nln -s bin/completion/zsh/_tldr $ZSH_CUSTOM/plugins/tldr/_tldr\n```\n\nThen add tldr to your oh-my-zsh plugins,\nusually defined in `~/.zshrc`,\nresulting in something looking like this:\n\n```zsh\nplugins=(git tmux tldr)\n```\n\nFret not regular zsh user!\nYou can also do this:\n\n```zsh\ntldr completion zsh\nsource ~/.zshrc\n```\n\n### bash\n\n```bash\ntldr completion bash\nsource ~/.bashrc\n```\n\nThis command will generate the appropriate completion script and append it to your shell's configuration file (`.zshrc` or `.bashrc`).\n\nIf you encounter any issues or need more information about the autocompletion setup, please refer to the [completion.js](https://github.com/tldr-pages/tldr-node-client/blob/master/lib/completion.js) file in the repository.\n\n## FAQ\n\n### Installation Issues\n\n- If you are trying to install as non-root user (`npm install -g tldr`) and get something like:\n\n```text\nError: EACCES: permission denied, access '/usr/local/lib/node_modules/tldr'\n```\n\nThen most probably your npm's default installation directory has improper permissions. You can resolve it by clicking [here](https://docs.npmjs.com/getting-started/fixing-npm-permissions)\n\n- If you are trying to install as a root user (`sudo npm install -g tldr`) and get something like:\n\n```shell\nas root -\u003e\ngyp WARN EACCES attempting to reinstall using temporary dev dir \"/usr/local/lib/node_modules/tldr/node_modules/webworker-threads/.node-gyp\"\ngyp WARN EACCES user \"root\" does not have permission to access the dev dir \"/usr/local/lib/node_modules/tldr/node_modules/webworker-threads/.node-gyp/8.9.1\"\n```\n\nYou need to add the option `--unsafe-perm` to your command. This is because when npm goes to the postinstall step, it downgrades the permission levels to \"nobody\". Probably you should fix your installation directory permissions and install as a non-root user in the first place.\n\n- If you see an error related to `webworker-threads` like:\n\n```text\n/usr/local/lib/node_modules/tldr/node_modules/natural/lib/natural/classifiers/classifier.js:32\n    if (e.code !== 'MODULE_NOT_FOUND') throw e;\n```\n\nMost probably you need to reinstall `node-gyp` and `webworker-threads`. Try this -\n\n```shell\nsudo -H npm uninstall -g tldr\nsudo -H npm uninstall -g webworker-threads\nnpm install -g node-gyp\nnpm install -g webworker-threads\nnpm install -g tldr\n```\n\nFor further context, take a look at this [issue](https://github.com/tldr-pages/tldr-node-client/issues/179)\n\n#### Colors under Cygwin\n\nColors can't be shown under Mintty or PuTTY, because the dependency `colors.js` has a bug.\nPlease show support to [this pull request](https://github.com/Marak/colors.js/pull/154), so it can be merged.\n\nMeanwhile, you can do one of the following to fix this issue:\n\n- Add the following script to your shell's rc file (`.zshrc`, `.bashrc`, etc.): (RECOMMENDED)\n\n```bash\ntldr_path=\"$(which tldr)\"\nfunction tldr() {\n  eval \"$tldr_path\" $@ \"--color\"\n}\n```\n\n- Add `alias tldr=\"tldr --color=true\"` to your shell's rc file.\n- Prepend `process.stdout.isTTY = true;` to `tldr.js` (NOT RECOMMENDED)\n- Fix `colors.js`'s logic (NOT RECOMMENDED)\n  - Go to `%appdata%\\npm\\node_modules\\tldr\\node_modules\\colors\\lib\\system\\`\n  - Overwrite `supports-colors.js` with [supports-colors.js](https://raw.githubusercontent.com/RShadowhand/colors.js/master/lib/system/supports-colors.js) from my repo.\n- Use `CMD.exe`.\n\n## Contributing\n\nContribution are most welcome!\nHave a look [over here](https://github.com/tldr-pages/tldr-node-client/blob/master/.github/CONTRIBUTING.md)\nfor a few rough guidelines.\n\n[npm-url]: https://www.npmjs.com/package/tldr\n[npm-image]: https://img.shields.io/npm/v/tldr.svg\n[gh-actions-url]: https://github.com/tldr-pages/tldr-node-client/actions?query=workflow%3ATest+branch%3Amaster\n[gh-actions-image]: https://img.shields.io/github/actions/workflow/status/tldr-pages/tldr-node-client/test.yml?branch=main\n[matrix-url]: https://matrix.to/#/#tldr-pages:matrix.org\n[matrix-image]: https://img.shields.io/matrix/tldr-pages:matrix.org?label=chat+on+matrix\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftldr-pages%2Ftldr-node-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftldr-pages%2Ftldr-node-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftldr-pages%2Ftldr-node-client/lists"}