mirror of
https://gitlab.com/sagidayan/linux-config.git
synced 2024-11-15 04:05:24 +00:00
19 lines
783 B
Bash
Executable file
19 lines
783 B
Bash
Executable file
#!/bin/bash
|
|
########################################################
|
|
# DO NOT EDIT - WILL BE DISCARDED IN NEXT PLAYBOOK RUN #
|
|
########################################################
|
|
|
|
# Get docs fast
|
|
selected=`cat ~/.shellconfig/cheat/topics | fzf --header="🏳️ Select a Topic: " --reverse`
|
|
if [[ -z $selected ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
read -p "What you want to know?: " query
|
|
|
|
query=`echo $query | tr ' ' '+'`
|
|
if [[ $selected == "TLDR" ]]; then
|
|
tmux neww -n "[🏳️ Cheat: ${selected}/${query}]" bash -c "tldr ${query} | bat --paging=always --file-name='${selected} | Query: ${query}'"
|
|
else
|
|
tmux neww -n "[🏳️ Cheat: ${selected}/${query}]" bash -c "curl -s https://cht.sh/$selected/$query | bat --paging=always --file-name='Topic: ${selected} | Query: ${query}'"
|
|
fi
|