From 81eed08fcd05aa224282ba58bf7c7586677ddb97 Mon Sep 17 00:00:00 2001 From: Steven De Coeyer Date: Thu, 25 Feb 2021 05:20:49 +0100 Subject: [PATCH] Removed trailing whitespace --- README.md | 12 ++++++------ tuxi | 14 +++++++------- tuxiqualitytest.sh | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 0c2a5b6..4484d3a 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@

TUXI

A CLI tool that scrapes Google search results and SERPs that provides instant and concise answers

-## +## Video Preview Gif ### How does this work? The script uses `pup` to scrape Google search results and SERPs. -If the query returns several results, Tuxi will choose the most +If the query returns several results, Tuxi will choose the most relevant result on the basis of priority. -In addition to scraping, `tuxi` also uses `jq`, `awk` and `sed` +In addition to scraping, `tuxi` also uses `jq`, `awk` and `sed` to process and return results, and `recode` to unescape html. @@ -33,7 +33,7 @@ cURL **tuxi** to your **$PATH** and give execute permissions. $ sudo curl -sL "https://raw.githubusercontent.com/Bugswriter/tuxi/main/tuxi" -o /usr/local/bin/tuxi $ sudo chmod +x /usr/local/bin/tuxi ``` -> To update, just do `curl` again, no need to `chmod` anymore. +> To update, just do `curl` again, no need to `chmod` anymore. > To uninstall, simply remove `tuxi` from your **$PATH**, for example `sudo rm -f /usr/local/bin/tuxi`. ### Make @@ -41,7 +41,7 @@ $ sudo chmod +x /usr/local/bin/tuxi $ git clone https://github.com/Bugswriter/tuxi.git && cd tuxi/ $ sudo make install ``` -> To update, just `git pull` on your local tuxi repository and reinstall with `sudo make install`. +> To update, just `git pull` on your local tuxi repository and reinstall with `sudo make install`. > To uninstall, simply run `sudo make uninstall`. ### Arch Linux AUR @@ -85,7 +85,7 @@ Report bugs at https://github.com/Bugswriter/tuxi/issues. ## Features -**Easily change query language** +**Easily change query language** Line [8](./tuxi#L8) in `tuxi` contains the language variable which can be changed according the user's preference. However, tuxi will use the system default langauge if none is set. **Gives corrections** diff --git a/tuxi b/tuxi index 860681e..06eb03e 100755 --- a/tuxi +++ b/tuxi @@ -80,7 +80,7 @@ raw=false quiet=false # search result output format (changes if raw=true) -output() { +output() { printf "%b---%b\n%s\n%b---%b\n" "$G" "$N" "$*" "$G" "$N" } @@ -98,10 +98,10 @@ while getopts "hrq" OPT; do help_text exit 0 ;; - r) + r) raw=true ;; - q) + q) quiet=true ;; *) @@ -121,7 +121,7 @@ shift $((OPTIND-1)) if $raw; then N=""; R=""; G=""; Y=""; M=""; C=""; - output () { + output () { printf "%s\n" "$*" } fi @@ -136,11 +136,11 @@ fi if [ -z "$1" ]; then if [ $quiet = "false" ]; then printf "Hi, I'm Tuxi. Ask me anything!\n" - help_text | head -n 1 + help_text | head -n 1 fi exit 0 fi - + # Else, all arguments are saved in $query query="$*" @@ -152,7 +152,7 @@ query="$*" user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0" google_url="https://www.google.com/search?hl="${LANGUAGE:="${LANG:=en_US}"}"" -# Response from Google via cURL (-G: get, -s: silent) +# Response from Google via cURL (-G: get, -s: silent) google_html=$(curl -Gs --compressed "$google_url" --user-agent "$user_agent" --data-urlencode "q=$query") diff --git a/tuxiqualitytest.sh b/tuxiqualitytest.sh index c35b1f6..d15d1d5 100755 --- a/tuxiqualitytest.sh +++ b/tuxiqualitytest.sh @@ -9,7 +9,7 @@ run="" while getopts "r" o; do case "${o}" in - r) + r) raw=true ;; *) @@ -20,7 +20,7 @@ done #this took to long for me to figure out if $raw; then - red="" + red="" run="-r" fi @@ -90,7 +90,7 @@ printf "Testing Translate¬\n" && ./tuxi $run "Vais para cascais? em ingles" 1>> printf "Testing Translate¬\n" && ./tuxi $run "برمجة in english" 1>>testoutputs.txt && printf "\tpassed.\n" || printf "\tFailed...\n" printf "Testing Translate¬\n" && ./tuxi $run "mañana in english?" 1>>testoutputs.txt && printf "\tpassed.\n" || printf "\tFailed...\n" printf "Testing Translate¬\n" && ./tuxi $run "what is mananeo in english" 1>>testoutputs.txt && printf "\tpassed.\n" || printf "\tFailed...\n" -#it looks like you can only convert to english without error +#it looks like you can only convert to english without error printf "Testing Weather¬\n" && ./tuxi $run "weather new york" 1>>testoutputs.txt && printf "\tpassed.\n" || printf "\tFailed...\n"