Anyone knows a way to get a one line weather output in the terminal window with specified location?
So far I'm using curl wttr.in/city but I would like a one output like City, Sunny 0'.
I've found something like this (first answer):
https://askubuntu.com/questions/390329/weather-from-terminal
Unfortunately it does not work. I've installed wget command with brew and tried running those three lines from .sh file.
Best Answer
Simplest solution is
ansiweather
which you can install withbrew
. The result looks like .If you want to write you own command/function it's not that difficult. If the output from the online location is in json, or something similar. You can use
jq
to parse json, and only print what you need.Read the manual page of
jq
to learn how to use it.I tried the API you're using above, that's not gonna help your case. Find some other one that replies in JSON. For example:
I haven't tested it personally, because you have to make an account to make a call, but you get the idea.
Comment if you get lost.