2024-10-03 17:44:42 +00:00
|
|
|
[![builds.sr.ht status](https://builds.sr.ht/~timharek/yr/commits/main/.build.yml.svg)](https://builds.sr.ht/~timharek/yr/commits/main/.build.yml?)
|
|
|
|
|
2024-10-03 14:27:37 +00:00
|
|
|
# [yr]
|
2024-09-24 18:38:24 +00:00
|
|
|
|
2024-10-11 09:21:51 +00:00
|
|
|
![screenshot](./screenshot.png)
|
|
|
|
|
2024-10-03 17:40:34 +00:00
|
|
|
Get the weather delivered to your command-line, or use as a Go package.
|
2024-10-03 14:13:14 +00:00
|
|
|
|
2024-10-03 14:27:37 +00:00
|
|
|
The project uses [Meteorologisk institutt]'s public API, [`LocationForecast`],
|
|
|
|
and [OpenStreetMap]'s [Nominatim] API.
|
|
|
|
|
2024-10-03 17:44:42 +00:00
|
|
|
## Install CLI
|
|
|
|
|
2024-10-04 19:02:18 +00:00
|
|
|
Using go:
|
|
|
|
|
|
|
|
```bash
|
2024-10-16 20:08:26 +00:00
|
|
|
go install git.sr.ht/~timharek/yr@latest
|
2024-10-04 19:02:18 +00:00
|
|
|
```
|
2024-10-03 17:44:42 +00:00
|
|
|
|
|
|
|
Adding more methods in the future. Help is wanted to achieve the best coverage.
|
|
|
|
|
2024-10-03 18:19:57 +00:00
|
|
|
### 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:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
wget https://git.sr.ht/~timharek/yr/refs/download/<release>/yr-<version>-linux-amd64.tar.gz
|
|
|
|
tar xf yr-<version>-linux-amd64.tar.gz
|
|
|
|
cd yr-<version>
|
|
|
|
cp yr /usr/local/bin
|
|
|
|
```
|
|
|
|
|
2024-10-03 14:13:14 +00:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Get help
|
|
|
|
yr --help
|
|
|
|
|
|
|
|
# Current forecast for location
|
|
|
|
yr now bergen
|
|
|
|
|
|
|
|
# Or with a space
|
|
|
|
yr now "new york"
|
|
|
|
|
|
|
|
# Forecast for multiple hours
|
|
|
|
yr forecast "new york"
|
|
|
|
|
|
|
|
# Forecast for next 5 hours
|
|
|
|
yr forecast "new york" -i 5
|
|
|
|
|
|
|
|
# Open forecast in your web browser
|
|
|
|
yr forecast "new york" --web
|
|
|
|
|
|
|
|
# Open now in your web browser
|
|
|
|
yr now "new york" --web
|
|
|
|
```
|
2024-10-03 14:27:37 +00:00
|
|
|
|
2024-10-03 17:40:34 +00:00
|
|
|
### As a package
|
|
|
|
|
|
|
|
```go
|
|
|
|
import "git.sr.ht/~timharek/yr/yr"
|
|
|
|
|
|
|
|
func weather() {
|
|
|
|
y := yr.New()
|
|
|
|
|
|
|
|
now := y.Now("bergen")
|
|
|
|
|
|
|
|
// Use the data
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2024-10-03 14:27:37 +00:00
|
|
|
## Contributing
|
|
|
|
|
|
|
|
Anyone can contribute to [yr]. Please refer to the [contribution guidelines].
|
|
|
|
|
|
|
|
Send patches to the [mailing list], report bugs on the [issue tracker].
|
|
|
|
|
|
|
|
[yr]: https://sr.ht/~timharek/yr/
|
|
|
|
[Meteorologisk institutt]: https://www.met.no/
|
|
|
|
[`LocationForecast`]: https://api.met.no/weatherapi/locationforecast/2.0/documentation
|
|
|
|
[OpenStreetMap]: https://www.openstreetmap.org/
|
|
|
|
[Nominatim]: https://nominatim.org/
|
|
|
|
[mailing list]: https://lists.sr.ht/~timharek/yr
|
|
|
|
[issue tracker]: https://todo.sr.ht/~timharek/yr
|
|
|
|
[contribution guidelines]: ./CONTRIBUTING.md
|
2024-10-03 18:19:57 +00:00
|
|
|
[available releases]: https://git.sr.ht/~timharek/yr/refs
|