solorice/.local/bin/chtsh
2023-08-16 00:17:26 +03:00

16 lines
456 B
Bash
Executable File

#!/bin/sh
selected=$(cat ~/.config/tmux/tmux-cht-languages ~/.config/tmux/tmux-cht-command | fzf)
if [[ -z $selected ]]; then
exit 0
fi
read -p "Enter Query: " query
if rg -qs "$selected" ~/.config/tmux/tmux-cht-languages; then
query=$(echo $query | tr ' ' '+')
tmux neww zsh -c "echo \"curl cht.sh/$selected/$query/\" & curl cht.sh/$selected/$query & while [ : ]; do sleep 1; done"
else
tmux neww zsh -c "curl -s cht.sh/$selected~$query | less"
fi