-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Useful scripts and programs
Marco Bonelli edited this page Aug 20, 2019
·
13 revisions
# 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]")
}
A 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
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 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