DEV Community

Cover image for Bashing inspiring quotes
kontrollanten
kontrollanten

Posted on

Bashing inspiring quotes

I like history and I like quotes. I think it's an easy way to widen my perspectives and get more humble to the world. But I also like Linux. So I decided to combine those two in a golang session.

It resulted in bash-quotes, a CLI for printing quotes from http://quotes.cat-v.org/.

It's a pretty simple app that's divided into two parts:

download-quotes
As the name says this part downloads the webpage, scrapes it and uses the <hr /> to identify when a quote ends. When that's done all the quotes are saved into a filepath that's given as an argument.

read-quote
When calling this binary a randomly chosen quote is printed to the screen with some nice colors. This is the binary that I'm calling at shell login to keep me inspired with thoughtful quotes.

What's next?

The web page has a lot of sections with quotes, I've only scraped the first page so I guess I'll scrape further next time I dig into this.

You're welcome to download and use it by visiting https://github.com/kontrollanten/bash-quotes and follow the install instructions. What do you think? Would you've done it another way?

Discussion (0)