Weather forecast from shell
There are hundreds of widgets around to show weather forecast. In Cinnamon you can install the "Weather desklet" but you can insall many others.
I'm used to work 70% of my time on a shell and I was wondering if there's is something to show weather forecats inside the terminal with some ascii graphic.
I discovered this site: wttr.in
Using the service provided by this site it was extremely simple to write three lines of script to add a function to the fish
shell.
1function weather --description "Show the weather for a given city"
2 curl wttr.in/$argv
3end
You can save the above script in ~/.config/fish/functions
, you can call the file weather.fish
.
At this point you can invoke the function from shell adding the name of the city you want the forecast for.
1> $ weather nyc
2Weather report: nyc
3
4 .-. Light rain
5 ( ). 21 °C
6 (___(__) ↖ 13 km/h
7 ‘ ‘ ‘ ‘ 14 km
8 ‘ ‘ ‘ ‘ 3.0 mm
9 ┌─────────────┐
10┌──────────────────────────────┬───────────────────────┤ Thu 09 Jun ├───────────────────────┬──────────────────────────────┐
11│ Morning │ Noon └──────┬──────┘ Evening │ Night │
12├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
13│ _`/"".-. Patchy rain po…│ \ / Partly cloudy │ \ / Partly cloudy │ \ / Clear │
14│ ,\_( ). 21 °C │ _ /"".-. +27(29) °C │ _ /"".-. 27 °C │ .-. 20 °C │
15│ /(___(__) ↗ 17-25 km/h │ \_( ). ↗ 22-25 km/h │ \_( ). → 25-29 km/h │ ― ( ) ― ↘ 23-28 km/h │
16│ ‘ ‘ ‘ ‘ 10 km │ /(___(__) 10 km │ /(___(__) 10 km │ `-’ 10 km │
17│ ‘ ‘ ‘ ‘ 0.1 mm | 84% │ 0.0 mm | 0% │ 0.0 mm | 0% │ / \ 0.0 mm | 0% │
18└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
19 ┌─────────────┐
20┌──────────────────────────────┬───────────────────────┤ Fri 10 Jun ├───────────────────────┬──────────────────────────────┐
21│ Morning │ Noon └──────┬──────┘ Evening │ Night │
22├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
23│ \ / Sunny │ \ / Sunny │ \ / Sunny │ \ / Clear │
24│ .-. 20 °C │ .-. 25 °C │ .-. 26 °C │ .-. +23(25) °C │
25│ ― ( ) ― → 11-13 km/h │ ― ( ) ― → 12-13 km/h │ ― ( ) ― → 18-22 km/h │ ― ( ) ― → 9-14 km/h │
26│ `-’ 10 km │ `-’ 10 km │ `-’ 10 km │ `-’ 10 km │
27│ / \ 0.0 mm | 0% │ / \ 0.0 mm | 0% │ / \ 0.0 mm | 0% │ / \ 0.0 mm | 0% │
28└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
29 ┌─────────────┐
30┌──────────────────────────────┬───────────────────────┤ Sat 11 Jun ├───────────────────────┬──────────────────────────────┐
31│ Morning │ Noon └──────┬──────┘ Evening │ Night │
32├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
33│ Cloudy │ _`/"".-. Patchy rain po…│ .-. Light drizzle │ _`/"".-. Patchy rain po…│
34│ .--. 20 °C │ ,\_( ). 19 °C │ ( ). 17 °C │ ,\_( ). 17 °C │
35│ .-( ). ↘ 9-12 km/h │ /(___(__) ↘ 8-10 km/h │ (___(__) ↓ 6-7 km/h │ /(___(__) ↓ 8-11 km/h │
36│ (___.__)__) 10 km │ ‘ ‘ ‘ ‘ 10 km │ ‘ ‘ ‘ ‘ 2 km │ ‘ ‘ ‘ ‘ 10 km │
37│ 0.0 mm | 0% │ ‘ ‘ ‘ ‘ 0.1 mm | 76% │ ‘ ‘ ‘ ‘ 0.5 mm | 60% │ ‘ ‘ ‘ ‘ 0.1 mm | 78% │
38└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
39Location: NYC, New York, United States of America [40.7305991,-73.9865811]
40
41Follow @igor_chubin for wttr.in updates
That's all, you can query weather forecast for any city in the world.