- Go 98.8%
- Makefile 1.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
git.sr.ht is being decommissioned. The Forgejo instance serves the go-import meta tag, so tag-based 'go get' keeps working under the new path. Docs updated to match. |
||
| cmd/yr | ||
| internal | ||
| pkg | ||
| vhs | ||
| .build.yml | ||
| .golangci.toml | ||
| CLAUDE.md | ||
| CONTRIBUTING.md | ||
| direction.go | ||
| direction_test.go | ||
| go.mod | ||
| go.sum | ||
| go.tool.mod | ||
| go.tool.sum | ||
| LICENSE.md | ||
| Makefile | ||
| README.md | ||
| symbol.go | ||
| symbol_test.go | ||
| uv.go | ||
| uv_test.go | ||
| wind.go | ||
| wind_test.go | ||
| yr.go | ||
| yr_test.go | ||
Please use lyn instead. This project was renamed.
yr
Get the weather delivered to your command-line, or use as a Go package, without the need for an API key!
The project uses Meteorologisk institutt's public API, LocationForecast,
and OpenStreetMap's Nominatim API.
Install CLI
Using go:
go install src.timharek.no/tim/yr/cmd/yr@latest
Using Homebrew
brew tap timharek/tap
brew install yr
Adding more methods in the future. Help is wanted to achieve the best coverage.
Using pre-compiled binary
Select the version you want to install available releases and download
it and add it to your bin or something similar.
Example:
wget https://src.timharek.no/tim/yr/releases/download/<release>/yr-<version>-linux-amd64.tar.gz
tar xf yr-<version>-linux-amd64.tar.gz
cd yr-<version>
cp yr /usr/local/bin
Configuration
yr uses a TOML config file located at $XDG_CONFIG_HOME/yr.toml (defaults to
~/.config/yr.toml on Linux/macOS). You can set a default location and
preferences so you don't have to specify them every time.
Example yr.toml:
use_utc = false
show_uv = false
show_beaufort = true
show_dewpoint = false
show_humidity = true
temperature_format = "celsius"
[location]
name = "Bergen, Norway"
longitude = 5.3221
latitude = 60.3913
With a default location configured, you can run commands without specifying a location:
yr now
yr forecast
yr today
Usage
# Get help
yr --help
# Current forecast for location
yr now bergen
# Or with a space
yr now "new york"
# Use default location from config
yr now
# Forecast for multiple hours
yr forecast "new york"
# Forecast for next 5 hours
yr forecast "new york" -i 5
# Today's weather, or at a specific hour
yr today bergen
yr today bergen 14
# Tomorrow's weather at a specific hour
yr tomorrow bergen 08
# Include UV index
yr now bergen --uv
# Show Beaufort scale description alongside wind
yr now bergen --beaufort
# Temperature in Fahrenheit
yr now bergen --format fahrenheit
# Open forecast in your web browser
yr forecast "new york" --web
# Open now in your web browser
yr now "new york" --web
# View current config
yr config
As a package
go get src.timharek.no/tim/yr
import "src.timharek.no/tim/yr"
func weather() {
client, err := yr.New()
if err != nil {
panic(err)
}
now := client.Now("bergen")
// Use the data
}
Similar projects
Contributing
Anyone can contribute to yr. Please refer to the contribution guidelines.
Send patches to the report bugs on the issue tracker.
