linux-config/files/dotfiles/shellconfig/cheat.sh

20 lines
683 B
Bash
Executable file

#!/bin/bash
########################################################
# DO NOT EDIT - WILL BE DISCARDED IN NEXT PLAYBOOK RUN #
########################################################
# Get docs fast
selected=`/bin/cat ~/.shellconfig/cheat/languages ~/.shellconfig/cheat/commands | fzf --header="Select a topic"`
if [[ -z $selected ]]; then
exit 0
fi
read -p "Enter Query: " query
if grep -qs "$selected" ~/.shellconfig/cheat/languages; then
query=`echo $query | tr ' ' '+'`
tmux neww bash -c "echo \"curl cht.sh/$selected/$query/\" & curl cht.sh/$selected/$query & while [ : ]; do sleep 1; done"
else
tmux neww bash -c "curl -s cht.sh/$selected~$query | less"
fi