Display weather forecast inside terminal using wego application.

At first go to OpenWeather to create an account and get an API key.

Free plan allows 60 calls per minute and 1,000,000 calls per month. These numbers are more than enough for personal use which is great.

Install wego utility.

➜ go install github.com/schachmat/wego@master
go: downloading github.com/schachmat/wego v0.0.0-20220218105006-fd65a65a6d6d
go: downloading github.com/schachmat/ingo v0.0.0-20170403011506-a4bdc0729a3f
go: downloading github.com/mattn/go-colorable v0.1.12
go: downloading github.com/mattn/go-runewidth v0.0.13
go: downloading github.com/rivo/uniseg v0.2.0
go: downloading github.com/mattn/go-isatty v0.0.14
go: downloading golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6

Ensure that it will be included in PATH. Update ~/.bashrc file accordingly.

$ export PATH="$PATH:~/go/bin"

Execute wego for the first time.

$ wego

It will create initial configuration file.

$ cat  ~/.wegorc 
# wego configuration
# 
# This config has https://github.com/schachmat/ingo syntax.
# Empty lines or lines starting with # will be ignored.
# All other lines must look like "KEY=VALUE" (without the quotes).
# The VALUE must not be enclosed in quotes as well!

# aat-frontend: Show geo coordinates (default false)
aat-coords=false

# aat-frontend: Monochrome output (default false)
aat-monochrome=false

# BACKEND to be used (default forecast.io)
backend=forecast.io

# caiyun backend: the api KEY to use (default )
caiyun-api-key=

# caiyun backend: print raw requests and responses (default true)
caiyun-debug=true

# caiyun backend: the LANGUAGE to request from caiyunapp.com/ (default en)
caiyun-lang=en

# NUMBER of days of weather forecast to be displayed (default 3)
days=3

# FRONTEND to be used (default ascii-art-table)
frontend=ascii-art-table

# json frontend: do not indent the output (default false)
jsn-no-indent=false

# LOCATION to be queried (default 40.748,-73.985)
location=40.748,-73.985

# openweathermap backend: the api KEY to use (default )
owm-api-key=

# openweathermap backend: print raw requests and responses (default false)
owm-debug=false

# openweathermap backend: the LANGUAGE to request from openweathermap (default en)
owm-lang=en

# UNITSYSTEM to use for output.
# Choices are: metric, imperial, si, metric-ms (default metric)
units=metric

# worldweatheronline backend: the api KEY to use (default )
wwo-api-key=

# worldweatheronline backend: print raw requests and responses (default false)
wwo-debug=false

# worldweatheronline backend: the LANGUAGE to request from worldweatheronline (default en)
wwo-lang=en

Create custom configuration.

$ cat <<EOF | tee ~/.wegorc 
# wego configuration
# 
# This config has https://github.com/schachmat/ingo syntax.
# Empty lines or lines starting with # will be ignored.
# All other lines must look like "KEY=VALUE" (without the quotes).
# The VALUE must not be enclosed in quotes as well!

# aat-frontend: Show geo coordinates (default false)
aat-coords=false

# aat-frontend: Monochrome output (default false)
aat-monochrome=false

# BACKEND to be used (default forecast.io)
backend=openweathermap

# NUMBER of days of weather forecast to be displayed (default 3)
days=3

# FRONTEND to be used (default ascii-art-table)
frontend=ascii-art-table

# json frontend: do not indent the output (default false)
jsn-no-indent=false

# LOCATION to be queried (default 40.748,-73.985)
location=Gdansk, PL

# openweathermap backend: the api KEY to use (default )
owm-api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# openweathermap backend: print raw requests and responses (default false)
owm-debug=false

# openweathermap backend: the LANGUAGE to request from openweathermap (default en)
owm-lang=en

# UNITSYSTEM to use for output.
# Choices are: metric, imperial, si, metric-ms (default metric)
units=metric

EOF

Display help information.

$ wego --help
Usage of wego:
  -aat-coords
    	aat-frontend: Show geo coordinates
  -aat-monochrome
    	aat-frontend: Monochrome output
  -b BACKEND
    	BACKEND to be used (shorthand) (default "forecast.io")
  -backend BACKEND
    	BACKEND to be used (default "forecast.io")
  -caiyun-api-key KEY
    	caiyun backend: the api KEY to use
  -caiyun-debug
    	caiyun backend: print raw requests and responses (default true)
  -caiyun-lang LANGUAGE
    	caiyun backend: the LANGUAGE to request from caiyunapp.com/ (default "en")
  -d NUMBER
    	NUMBER of days of weather forecast to be displayed (shorthand) (default 3)
  -days NUMBER
    	NUMBER of days of weather forecast to be displayed (default 3)
  -f FRONTEND
    	FRONTEND to be used (shorthand) (default "ascii-art-table")
  -frontend FRONTEND
    	FRONTEND to be used (default "ascii-art-table")
  -jsn-no-indent
    	json frontend: do not indent the output
  -l LOCATION
    	LOCATION to be queried (shorthand) (default "40.748,-73.985")
  -location LOCATION
    	LOCATION to be queried (default "40.748,-73.985")
  -owm-api-key KEY
    	openweathermap backend: the api KEY to use
  -owm-debug
    	openweathermap backend: print raw requests and responses
  -owm-lang LANGUAGE
    	openweathermap backend: the LANGUAGE to request from openweathermap (default "en")
  -u UNITSYSTEM
    	UNITSYSTEM to use for output. (shorthand)
    	    	Choices are: metric, imperial, si, metric-ms (default "metric")
  -units UNITSYSTEM
    	UNITSYSTEM to use for output.
    	    	Choices are: metric, imperial, si, metric-ms (default "metric")
  -wwo-api-key KEY
    	worldweatheronline backend: the api KEY to use
  -wwo-debug
    	worldweatheronline backend: print raw requests and responses
  -wwo-lang LANGUAGE
    	worldweatheronline backend: the LANGUAGE to request from worldweatheronline (default "en")
Available backends: caiyunapp.com, json, openweathermap, smhi, worldweatheronline
Available frontends: ascii-art-table, emoji, json

Finally, display weather forecast.

$ wego
Weather for Gdańsk, PL

               broken clouds
      .--.     2 (3) °C       
   .-(    ).    10 km/h      
  (___.__)__)                 
               0.0 mm/h       
                                                       ┌─────────────┐                                                       
┌──────────────────────────────┬───────────────────────┤ Sat 19. Mar ├───────────────────────┬──────────────────────────────┐
│           Morning            │             Noon      └──────┬──────┘    Evening            │            Night             │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│               broken clouds  │               broken clouds  │               broken clouds  │               broken clouds  │
│      .--.     2 (3) °C       │      .--.     2 (3) °C       │      .--.     2 (3) °C       │      .--.     2 (3) °C       │
│   .-(    ).    10 km/h      │   .-(    ).    10 km/h      │   .-(    ).    10 km/h      │   .-(    ).    10 km/h      │
│  (___.__)__)  (___.__)__)  (___.__)__)  (___.__)__)                 │
│               0.0 mm/h       │               0.0 mm/h       │               0.0 mm/h       │               0.0 mm/h       │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
                                                       ┌─────────────┐                                                       
┌──────────────────────────────┬───────────────────────┤ Sun 20. Mar ├───────────────────────┬──────────────────────────────┐
│           Morning            │             Noon      └──────┬──────┘    Evening            │            Night             │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│     \   /     clear sky      │     \   /     clear sky      │     \   /     clear sky      │     \   /     clear sky      │
│      .-.      5 (5) °C       │      .-.      7 (7) °C       │      .-.      4 (4) °C       │      .-.      3 (3) °C       │
│   ‒ (   ) ‒    11 km/h      │   ‒ (   ) ‒    12 km/h      │   ‒ (   ) ‒    10 km/h      │   ‒ (   ) ‒    7 km/h       │
│      `-᾿          `-᾿          `-᾿          `-᾿                     │
│     /   \     0.0 mm/h       │     /   \     0.0 mm/h       │     /   \     0.0 mm/h       │     /   \     0.0 mm/h       │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
                                                       ┌─────────────┐                                                       
┌──────────────────────────────┬───────────────────────┤ Mon 21. Mar ├───────────────────────┬──────────────────────────────┐
│           Morning            │             Noon      └──────┬──────┘    Evening            │            Night             │
├──────────────────────────────┼──────────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│     \   /     clear sky      │     \   /     clear sky      │     \   /     clear sky      │     \   /     clear sky      │
│      .-.      6 (6) °C       │      .-.      9 (9) °C       │      .-.      5 (5) °C       │      .-.      4 (4) °C       │
│   ‒ (   ) ‒    9 km/h       │   ‒ (   ) ‒    9 km/h       │   ‒ (   ) ‒    7 km/h       │   ‒ (   ) ‒    6 km/h       │
│      `-᾿          `-᾿          `-᾿          `-᾿                     │
│     /   \     0.0 mm/h       │     /   \     0.0 mm/h       │     /   \     0.0 mm/h       │     /   \     0.0 mm/h       │
└──────────────────────────────┴──────────────────────────────┴──────────────────────────────┴──────────────────────────────┘
$ wego --frontend emoji --days 5
Weather for Gdańsk, PL

  broken clouds
☁️  2 (3) °C    
                            ┌───────┐ 
┌───────────────┬───────────┤  Sat  ├───────────┬───────────────┐
│    Morning    │    Noon   └───┬───┘ Evening   │     Night     │
├───────────────┼───────────────┼───────────────┼───────────────┤
│               │  broken clouds│  broken clouds│  broken clouds│
│✨ ? °C        │☁️  2 (3) °C    │☁️  2 (3) °C    │☁️  2 (3) °C    │
└───────────────┴───────────────┴───────────────┴───────────────┘
 
                            ┌───────┐ 
┌───────────────┬───────────┤  Sun  ├───────────┬───────────────┐
│    Morning    │    Noon   └───┬───┘ Evening   │     Night     │
├───────────────┼───────────────┼───────────────┼───────────────┤
│  clear sky    │  clear sky    │  clear sky    │  clear sky    │
│☀️  5 (5) °C    │☀️  7 (7) °C    │☀️  4 (4) °C    │☀️  3 (3) °C    │
└───────────────┴───────────────┴───────────────┴───────────────┘
 
                            ┌───────┐ 
┌───────────────┬───────────┤  Mon  ├───────────┬───────────────┐
│    Morning    │    Noon   └───┬───┘ Evening   │     Night     │
├───────────────┼───────────────┼───────────────┼───────────────┤
│  clear sky    │  clear sky    │  clear sky    │  clear sky    │
│☀️  6 (6) °C    │☀️  9 (9) °C    │☀️  5 (5) °C    │☀️  4 (4) °C    │
└───────────────┴───────────────┴───────────────┴───────────────┘
 
                            ┌───────┐ 
┌───────────────┬───────────┤  Tue  ├───────────┬───────────────┐
│    Morning    │    Noon   └───┬───┘ Evening   │     Night     │
├───────────────┼───────────────┼───────────────┼───────────────┤
│  clear sky    │  clear sky    │  clear sky    │  clear sky    │
│☀️  8 (8) °C    │☀️  11 (11) °C  │☀️  8 (8) °C    │☀️  7 (7) °C    │
└───────────────┴───────────────┴───────────────┴───────────────┘
 
                            ┌───────┐ 
┌───────────────┬───────────┤  Wed  ├───────────┬───────────────┐
│    Morning    │    Noon   └───┬───┘ Evening   │     Night     │
├───────────────┼───────────────┼───────────────┼───────────────┤
│  clear sky    │  clear sky    │  clear sky    │  clear sky    │
│☀️  11 (11) °C  │☀️  12 (12) °C  │☀️  4 (4) °C    │☀️  4 (4) °C    │
└───────────────┴───────────────┴───────────────┴───────────────┘

Get JSON file in case you want to store data locally.

$ wego --frontend json --days 1
{
	"Current": {
		"Time": "2022-03-19T22:00:00+01:00",
		"Code": 18,
		"Desc": "broken clouds",
		"TempC": 2.39,
		"FeelsLikeC": 3.34,
		"ChanceOfRainPercent": null,
		"PrecipM": 0,
		"VisibleDistM": null,
		"WindspeedKmph": 10.115999,
		"WindGustKmph": null,
		"WinddirDegree": 62,
		"Humidity": 90
	},
	"Forecast": [
		{
			"Date": "2022-03-19T22:00:00+01:00",
			"Slots": [
				{
					"Time": "2022-03-19T22:00:00+01:00",
					"Code": 18,
					"Desc": "broken clouds",
					"TempC": 2.39,
					"FeelsLikeC": 3.34,
					"ChanceOfRainPercent": null,
					"PrecipM": 0,
					"VisibleDistM": null,
					"WindspeedKmph": 10.115999,
					"WindGustKmph": null,
					"WinddirDegree": 62,
					"Humidity": 90
				}
			],
			"Astronomy": {
				"Moonrise": "0001-01-01T00:00:00Z",
				"Moonset": "0001-01-01T00:00:00Z",
				"Sunrise": "0001-01-01T00:00:00Z",
				"Sunset": "0001-01-01T00:00:00Z"
			}
		}
	],
	"Location": "Gdańsk, PL",
	"GeoLoc": null
}

Lovely app. Check out wttr.in if you are looking for an alternative that does not require an API key for weather service.

ko-fi