Skip to content

Instantly share code, notes, and snippets.

@milon
Last active March 18, 2022 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milon/123cb6527bf90d702da5270844b63646 to your computer and use it in GitHub Desktop.
Save milon/123cb6527bf90d702da5270844b63646 to your computer and use it in GitHub Desktop.
A little alias for showing weather in command line

Prerequisite

It assumes you have curl installed in your system.

Install

Add this function in your .bashrc or .zshrc file.

weather() {curl wttr.in/${1:-Berlin}}

Uses

In the command line, just type weather. It will show the weather of Münster as mentioned in the .weather file. You can change it to your current location. If you want to see the weather of other location, just type weather name_of_the_place like weather Dhaka, it will show the weather of that place.

Output Example

weather Münster

    \  /       Partly cloudy
  _ /"".-.     27 °C          
    \_(   ).   ↗ 26 km/h      
    /(___(__)  10 km          
               0.0 mm         
                                                       ┌─────────────┐                                                       
┌──────────────────────────────┬───────────────────────┤  Wed 20 Jun ├───────────────────────┬──────────────────────────────┐
│            Morning           │             Noon      └──────┬──────┘     Evening           │             Night            │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│    \  /       Partly cloudy  │  _`/"".-.     Patchy rain po…│    \  /       Partly cloudy  │    \  /       Partly cloudy  │
│  _ /"".-.     21 °C          │   ,\_(   ).   24-26 °C       │  _ /"".-.     25-26 °C       │  _ /"".-.     21 °C          │
│    \_(   ).   ↗ 13-16 km/h   │    /(___(__)  ↗ 15-17 km/h   │    \_(   ).   → 14-21 km/h   │    \_(   ).   → 12-24 km/h   │
│    /(___(__)  20 km          │      ‘ ‘ ‘ ‘  20 km          │    /(___(__)  20 km          │    /(___(__)  20 km          │
│               0.1 mm | 58%   │     ‘ ‘ ‘ ‘   0.0 mm | 29%   │               0.0 mm | 0%    │               0.1 mm | 49%   │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
                                                       ┌─────────────┐                                                       
┌──────────────────────────────┬───────────────────────┤  Thu 21 Jun ├───────────────────────┬──────────────────────────────┐
│            Morning           │             Noon      └──────┬──────┘     Evening           │             Night            │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│               Overcast       │  _`/"".-.     Light rain sho…│    \  /       Partly cloudy  │    \  /       Partly cloudy  │
│      .--.     16 °C          │   ,\_(   ).   17 °C          │  _ /"".-.     13-15 °C       │  _ /"".-.     9-12 °C        │
│   .-(    ).   → 27-35 km/h   │    /(___(__)  → 34-40 km/h   │    \_(   ).   → 28-38 km/h   │    \_(   ).   → 23-37 km/h   │
│  (___.__)__)  15 km          │      ‘ ‘ ‘ ‘  14 km          │    /(___(__)  17 km          │    /(___(__)  18 km          │
│               0.4 mm | 61%   │     ‘ ‘ ‘ ‘   0.3 mm | 88%   │               0.0 mm | 0%    │               0.0 mm | 0%    │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
                                                       ┌─────────────┐                                                       
┌──────────────────────────────┬───────────────────────┤  Fri 22 Jun ├───────────────────────┬──────────────────────────────┐
│            Morning           │             Noon      └──────┬──────┘     Evening           │             Night            │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│               Overcast       │  _`/"".-.     Light rain sho…│  _`/"".-.     Patchy rain po…│               Cloudy         │
│      .--.     10-13 °C       │   ,\_(   ).   13-14 °C       │   ,\_(   ).   13-14 °C       │      .--.     10-12 °C       │
│   .-(    ).   → 29-40 km/h   │    /(___(__)  → 26-35 km/h   │    /(___(__)  ↘ 23-32 km/h   │   .-(    ).   → 19-30 km/h   │
│  (___.__)__)  15 km          │      ‘ ‘ ‘ ‘  14 km          │      ‘ ‘ ‘ ‘  14 km          │  (___.__)__)  16 km          │
│               0.5 mm | 55%   │     ‘ ‘ ‘ ‘   0.3 mm | 27%   │     ‘ ‘ ‘ ‘   0.2 mm | 27%   │               0.1 mm | 48%   │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
Location: Münster, Regierungsbezirk Münster, Nordrhein-Westfalen, Deutschland [51.9501317,7.61330165026]

New feature: multilingual location names wttr.in/станция+Восток (in UTF-8) and location search wttr.in/~Kilimanjaro (just add ~ before)
Follow @igor_chubin for wttr.in updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment