Skip to content

Instantly share code, notes, and snippets.

@albertogalan
Created April 4, 2019 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albertogalan/98871372b3184420730ff723e89e86d9 to your computer and use it in GitHub Desktop.
Save albertogalan/98871372b3184420730ff723e89e86d9 to your computer and use it in GitHub Desktop.
#!/bin/bash
# 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]")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment