From dbe28d0996db6e14269e42ce4b67d7a36c440f60 Mon Sep 17 00:00:00 2001 From: vx-clutch Date: Thu, 25 Jul 2024 11:37:42 -0400 Subject: [PATCH] feat: scripts; cht.sh --- scripts/tmux-cht.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 scripts/tmux-cht.sh diff --git a/scripts/tmux-cht.sh b/scripts/tmux-cht.sh new file mode 100755 index 0000000..d639c24 --- /dev/null +++ b/scripts/tmux-cht.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +selected=`cat ~/.tmux-cht-languages ~/.tmux-cht-command | fzf` +if [[ -z $selected ]]; then + exit 0 +fi + +read -p "Enter Query: " query + +if grep -qs "$selected" ~/.tmux-cht-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