2022-01-10 08:11:20 +00:00
|
|
|
#!/bin/bash
|
|
|
|
########################################################
|
|
|
|
# DO NOT EDIT - WILL BE DISCARDED IN NEXT PLAYBOOK RUN #
|
|
|
|
########################################################
|
|
|
|
|
|
|
|
# Get docs fast
|
2022-01-18 09:19:19 +00:00
|
|
|
SELECTED=`cat ~/.shellconfig/cheat/topics | fzf --header="🏳️ Select a Topic: " --reverse`
|
|
|
|
if [[ -z $SELECTED ]]; then
|
2022-01-10 08:11:20 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2022-01-18 09:19:19 +00:00
|
|
|
read -p "🏳️ What do you want to know about ${SELECTED}?: " query
|
2022-01-10 08:11:20 +00:00
|
|
|
|
2022-01-13 17:29:48 +00:00
|
|
|
query=`echo $query | tr ' ' '+'`
|
2022-01-18 09:19:19 +00:00
|
|
|
if [[ $SELECTED == "TLDR" ]]; then
|
|
|
|
tmux neww -n "[🏳️ Cheat: ${SELECTED}/${query}]" bash -c "tldr ${query} | bat --paging=always --file-name='${SELECTED} | Query: ${query}'"
|
2022-01-10 08:11:20 +00:00
|
|
|
else
|
2022-01-18 09:19:19 +00:00
|
|
|
tmux neww -n "[🏳️ Cheat: ${SELECTED}/${query}]" bash -c "curl -s https://cht.sh/$SELECTED/$query | bat --paging=always --file-name='Topic: ${SELECTED} | Query: ${query}'"
|
2022-01-10 08:11:20 +00:00
|
|
|
fi
|