February 24, 2021

538 words 3 mins read

Bugswriter/tuxi

Bugswriter/tuxi

Tuxi is a cli assistant. Get answers of your questions instantly.

repo name Bugswriter/tuxi
repo link https://github.com/Bugswriter/tuxi
homepage
language Shell
size (curr.) 414 kB
stars (curr.) 923
created 2021-02-14
license GNU General Public License v3.0

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 relevant result on the basis of priority.

In addition to scraping, tuxi also uses jq, awk and sed to process and return results, and recode to unescape html.

Watch this video for more info

Also checkout BugsWriter’s YouTube channel for more scripts like this.

Requirements

  • pup - CLI tool for processing HTML.
  • recode - Charset converter tool and library.
  • jq - Command-line JSON processor.

Installation

cURL

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 uninstall, simply remove tuxi from your $PATH, for example sudo rm -f /usr/local/bin/tuxi.

Make

$ 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 uninstall, simply run sudo make uninstall.

Arch Linux AUR

Tuxi is available as the tuxi-git package in the AUR.

$ yay -S tuxi-git

Usage

$ tuxi "Is Linux better than Windows?"
---
Linux has a reputation for being fast and smooth while
Windows 10 is known to become slow and slow over
time. Linux runs faster than Windows 8.1 and Windows 10
along with a modern desktop environment and qualities of the
operating system while windows are slow on older hardware.
---
  • Quotations are optional, but should be used if you want to search with special characters (?=!|&<>%$#/\).
  • You can also write your query as a statement, e.g: tuxi linus torvalds birthday.
  • The -r option will make the output not have formatting, which can be convenient for use in scripts.
  • The -q option silences “Did you mean?” and Tuxi’s greeting on calling tuxi.

Use -h to display the help message.

$ tuxi -h
Usage: tuxi [options] query

Options:
  -h                    Show this help message and exit.
  -r                    Raw search results.
                        (no pretty output, no colors)
  -q                    Only output search results.
                        (silences "Did you mean?", greeting, usage)

Report bugs at https://github.com/Bugswriter/tuxi/issues.

Features

Easily change query language
Line 8 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

$ tuxi linux torvalds birthday
> Did you mean linus?
---
28 December 1969
---

When you know it’s actually linux torvalds -q option

$ tuxi -q linux torvalds birthday
---
28 December 1969
---

Raw formatting for output (no colors) -r option

Useful for e.g scripting notify-send.

$ tuxi -r linux torvalds birthday
> Did you mean linus?
28 December 1969

Math operations

$ tuxi "log(30)"
---
1.4771212547196624
---

Translate

$ tuxi "I love you in japanese"
---
わたしは、あなたを愛しています
---
$ tuxi "わたしは、あなたを愛しています in english"
---
I love you
---

And much more (lyrics, weather, conversions…)

License

This project is licensed under GPL-3.0.

Contributing

If you want to contribute, please see CONTRIBUTING.

comments powered by Disqus