diff --git a/tlrc/README.md b/tlrc/README.md new file mode 100644 index 000000000..d69c6b349 --- /dev/null +++ b/tlrc/README.md @@ -0,0 +1,72 @@ +--- +title: tlrc +homepage: https://github.com/tldr-pages/tlrc +tagline: | + tlrc: A fast tldr client written in Rust. +--- + +To update or switch versions, run `webi tlrc@stable` (or `@v1.11`, `@beta`, +etc). + +### Files + +These are the files / directories that are created and/or modified with this +install: + +```text +~/.config/envman/PATH.env +~/.local/bin/tlrc +~/.local/opt/tlrc/ +``` + +## Cheat Sheet + +> `tlrc` is a fast tldr client written in Rust. It provides community-maintained +> help pages for command-line tools with practical examples instead of lengthy +> man pages. + +To get help for a command: + +```sh +tlrc tar +``` + +### List all available pages + +To see all available commands: + +```sh +tlrc --list +``` + +### Update the cache + +To update the local cache of tldr pages: + +```sh +tlrc --update +``` + +### Search for commands + +To search for commands containing a keyword: + +```sh +tlrc --search "compress" +``` + +### Show examples for specific platform + +To show examples for a specific platform: + +```sh +tlrc --platform linux tar +``` + +### Random page + +To display a random page: + +```sh +tlrc --random +``` diff --git a/tlrc/install.sh b/tlrc/install.sh new file mode 100644 index 000000000..2c66d1ba0 --- /dev/null +++ b/tlrc/install.sh @@ -0,0 +1,43 @@ +#!/bin/sh +set -e +set -u + +__init_tlrc() { + + ############### + # Install tlrc # + ############### + + # Every package should define these 6 variables + pkg_cmd_name="tlrc" + + pkg_dst_cmd="$HOME/.local/bin/tlrc" + pkg_dst="$pkg_dst_cmd" + + pkg_src_cmd="$HOME/.local/opt/tlrc-v$WEBI_VERSION/tlrc" + pkg_src_dir="$HOME/.local/opt/tlrc-v$WEBI_VERSION" + pkg_src="$pkg_src_cmd" + + # pkg_install must be defined by every package + pkg_install() { + # ~/.local/opt/tlrc-v1.11.1/ + mkdir -p "$(dirname "${pkg_src_cmd}")" + + # mv ./tlrc ~/.local/opt/tlrc-v1.11.1/tlrc + mv ./tlrc "${pkg_src_cmd}" + } + + # pkg_get_current_version is recommended, but not required + pkg_get_current_version() { + # 'tlrc --version' has output in this format: + # tlrc 1.11.1 + # This trims it down to just the version number: + # 1.11.1 + tlrc --version 2> /dev/null | + head -n 1 | + cut -d ' ' -f 2 + } + +} + +__init_tlrc diff --git a/tlrc/releases.js b/tlrc/releases.js new file mode 100644 index 000000000..9dc68bf05 --- /dev/null +++ b/tlrc/releases.js @@ -0,0 +1,19 @@ +'use strict'; + +var github = require('../_common/github.js'); +var owner = 'tldr-pages'; +var repo = 'tlrc'; + +module.exports = function () { + return github(null, owner, repo).then(function (all) { + // tlrc has a clean release structure, no filtering needed + return all; + }); +}; + +if (module === require.main) { + module.exports().then(function (all) { + all = require('../_webi/normalize.js')(all); + console.info(JSON.stringify(all, null, 2)); + }); +}