This repository has been archived on 2025-12-28. You can view files and clone it, but cannot push or open issues or pull requests.
inks-scripts/scripts/cht.sh

20 lines
737 B
Bash
Executable File

#!/bin/bash
commands="find man tldr sed awk tr cp ls grep xargs rg ps mv kill lsof less head tail tar cp rm rename jq cat ssh cargo git git-worktree git-status git-commit git-rebase docker docker-compose stow chmod chown make"
languages="golang solidity vlang v nodejs javascript tmux typescript zsh cpp c lua rust python bash php haskell ArnoldC css html gdb"
selected=$(echo "$commands $languages" | tr ' ' '\n' | fzf)
if [[ -z $selected ]]; then
exit 0
fi
read -p "Enter Query: " query
if grep -qs "$selected" "$languages"; then
query=$(echo "$query" | tr ' ' '+')
tmux neww bash -c "curl cht.sh/$selected/$query & while [ : ]; do sleep 1; done"
else
tmux neww bash -c "curl -s cht.sh/$selected~$query | less"
fi