Skip to content

Useful scripts and programs

Sebastiaan Speck edited this page Oct 30, 2023 · 13 revisions

Create a new issue if a page doesn't exist

# create a new issue if not found (requires hub cli client)
# checks brew and cargo for homepage + description

function tld {
  tldr $* 2>/dev/null && return
  local repo=~/code/tldr # replace with location to tldr repo
  local info=("${(@f)$(brew info --json=v1 $1 2>/dev/null | jq -r '.[].homepage,.[].desc')}")
  test $#info -gt 1 || info=("${(@f)$(cargo show $1 2>/dev/null | awk '/^homepage|description/ { $1=""; print }')}")
  test $#info -gt 1 || return
  hub -C $repo issue | grep $1 && return
  hub -C $repo issue create -F <(echo "page request: $1\n\nAdd documentation for [$1]($info[1])\n$info[2]")
}

Find outdated and missing pages

A website containing a table listing all tldr pages and information about their translations.

  • The translation for a language is completed if there's a green checkmark.
  • A yellow sign warns you about a translation which may be outdated. (We compare the number of entries in the English version of the page and the translated page.)
  • There's no translation for a given page if the cell is marked with a red cross.

The table itself is updated daily by the tool TldrProgress. You can report issues and open pull requests at the tool's repository.

Hint: Search faster for a page by using your browsers search, press Ctrl + F to open it.

https://lukwebsforge.github.io/tldri18n/

Find pages that don't exist

A Bash shell script that finds pages that haven't been created yet can be found here. It has 2 modes:

  • history - Searches your ~/.bash_history
  • man - Searches the installed man pages

For apt-based Linux systems, this apt repository contains it as the tldr-missing-pages package.

A fork that extends upon this functionality can be found here. In addition to the ones listed above, it contains two other modes:

  • zhistory - Searches your ~./zsh_history
  • commands - Searches all commands that can be executed on the system

Translation helper: find next page to translate

A Python script that finds the next page (in alphabetical order) that needs to be translated from English to the chosen target language, copies it in the correct folder and optionally opens it in the default text editor (i.e. the command editor). To use, simply download and run the script inside the tldr repository after cloning it.

Script available here: tldr_translate_next_page.py.

usage: ./tldr_translate_next_page.py [-h] [-c] LANGUAGE

positional arguments:
  LANGUAGE         target language (e.g. it)

optional arguments:
  -h, --help       show this help message and exit
  -c, --copy-only  only copy the file, without opening it in the text editor

Page creation tool helper

A simple Go program to help the creation of TLDR pages which fixes some of the syntax for you as you write the pages through an interactive creation.

Installation instructions and the code can be found here

Clone this wiki locally