Browse Source

how: cheat.sh

master
Maxim Likhachev 6 years ago committed by Maxim Likhachev
parent
commit
a588c53b51
  1. 1
      README.md
  2. 35
      how

1
README.md

@ -75,6 +75,7 @@ will create the symbolic link for each script in the \<path> directory. @@ -75,6 +75,7 @@ will create the symbolic link for each script in the \<path> directory.
## Development tools
- [doctools2man](doctools2man) converts doctool to man pages.
- [how](how) shows dev cheat sheets using [cheat.sh](https://cheat.sh).
- [robodoc2html](robodoc2html) converts a documentation in the robodoc format into html.
- [utable](utable) shows a Unicode table.

35
how

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
#!/bin/bash
#Создан: вт 03 дек 2019 11:14:23
#Изменён: вт 03 дек 2019 21:18:38
BINDIR=${SHELLRC}/bin/
SCRIPT=cheat.sh
check_cheat() {
command -V "$SCRIPT" >/dev/null 2>&1
}
install_cheat() {
curl -sq https://cht.sh/:cht.sh > "${BINDIR}/${SCRIPT}"
chmod +x "${BINDIR}/${SCRIPT}"
echo "[INFO] cheat.sh has been installed to ${BINDIR}/${SCRIPT}."
}
tip() {
if [[ $1 == @* ]]; then
CHTSH_QUERY_OPTIONS="style=borland" cheat.sh --shell "${1/@/}"
elif [[ $1 == %* ]]; then
echo stealth Q | CHTSH_QUERY_OPTIONS="style=borland" cheat.sh --shell "${1/\%/}"
else
CHTSH_QUERY_OPTIONS="style=borland" cheat.sh "$@" | less -R
fi
}
check_cheat || install_cheat
tip "$@"
Loading…
Cancel
Save