17 lines
395 B
Bash
17 lines
395 B
Bash
|
#!/bin/bash -eu
|
||
|
|
||
|
cli=$1
|
||
|
page=${2-README.md}
|
||
|
|
||
|
# lookup cli in catalog
|
||
|
printf -v filter '.%s|.github' ${cli}
|
||
|
gh=$(yq ${filter} catalog.yaml)
|
||
|
|
||
|
# build gh README URL
|
||
|
printf -v url1 'https://github.com/%s/raw/main/%s' ${gh} ${page}
|
||
|
printf -v url2 'https://github.com/%s/raw/master/%s' ${gh} ${page}
|
||
|
|
||
|
# curl and pipe to bat
|
||
|
CURL="curl -fsS -L"
|
||
|
{ ${CURL} "${url1}" || ${CURL} "${url2}" ; } | glow -p -
|