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

2 years ago
  1. #!/usr/bin/env bash
  2. languages=(
  3. "zsh"
  4. "typescript"
  5. "bash"
  6. "perl"
  7. "python"
  8. "javascript"
  9. "go"
  10. "rust"
  11. )
  12. utilities=(
  13. "awk"
  14. "sed"
  15. "grep"
  16. "tr"
  17. "xargs"
  18. "tee"
  19. )
  20. SEARCHED="$( (for x in "${languages[@]}"; do
  21. echo "$x"
  22. done
  23. for x in "${utilities[@]}"; do
  24. echo "$x"
  25. done) | fzf)"
  26. if test -z "$SEARCHED"; then
  27. exit 0
  28. fi
  29. if (IFS=$'\n' echo "${languages[@]}") | grep "$SEARCHED" > /dev/null 2> /dev/null; then
  30. read -rp "Search Query: " QUERY
  31. curl "https://cht.sh/$SEARCHED/$QUERY" | less
  32. else
  33. curl "https://cht.sh/$SEARCHED" | less
  34. fi