You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
565 B

#!/usr/bin/env bash
languages=(
"zsh"
"typescript"
"bash"
"perl"
"python"
"javascript"
"go"
"rust"
)
utilities=(
"awk"
"sed"
"grep"
"tr"
"xargs"
"tee"
)
SEARCHED="$( (for x in "${languages[@]}"; do
echo "$x"
done
for x in "${utilities[@]}"; do
echo "$x"
done) | fzf)"
if test -z "$SEARCHED"; then
exit 0
fi
if (IFS=$'\n' echo "${languages[@]}") | grep "$SEARCHED" > /dev/null 2> /dev/null; then
read -rp "Search Query: " QUERY
curl "https://cht.sh/$SEARCHED/$QUERY" | less
else
curl "https://cht.sh/$SEARCHED" | less
fi