I’ve been playing around with various command line tools and will be sharing some of the fun ones I’ve found here on LowEndBox. Today’s tool: ansiweather.
ansiweather -a false -l "Portland,US" -u imperial
Weather in Portland => 45 °F - Wind => 5.99 mph S - Humidity => 63 % - Pressure => 30.12 inHg
Of course, it’s called ansiweather so if you leave out the “-a false” you’ll get things in color.
This is a standard Debian package, so just
apt-get install ansiweather
And you can find further documentation here.
Under the covers, it’s a very simple script – and it’s just that, a shell script. /bin/sh in fact – no bashisms and it runs cleanly Linuxes and BSDs.
It works by querying the openweathermap.org API, and then parsing the JSON it gets back using jq, a command-line JSON parser.
After that it’s just formatting, processing options, and adding colors.
The code is quite nicely formatted. If you’re tempted to change it to get the output different, you might just want to query the API directly and emit different stuff with jq – and the code is a great reference on how to do that.
Related Posts:
"OMG! I Never Knew That!": The Simply Linux Tip That Has Got Me More Thanks Than Anything I've Ever ...
Need a Laugh? Read the Linux Kernel List's Foam-Mouthed Responses to Russian Programmers Banned from...
Nontechnical Nonsense: Rust Stirs Up a Storm of Drama in the Linux Kernel: Ted T'so Shouting, Mainta...
RedHat Prepares to Give Bootloaders the Boot
Irritation Removed: You Do Everything As Root And Hate Manually Removing Sudo From Copy-Paste Comman...
Has the Itanic Finally Hit Its Last Iceberg? It's Been Removed From the Linux Kernel After a Little...
- The Best Felware Offer Yet!Cheap, Awesome Dedicated Servers in Madison, Wisconsin - January 25, 2025
- Bonus Code Friday!Can You Match The Legendary Pac-Man High Score on the Arcade You Could Win from RackNerd? - January 24, 2025
- We Called It Wrong: Ross Ulbricht, Who Masterminded Multiple Attempted Murders, Has Been Pardoned - January 22, 2025
Leave a Reply