docs: Add package usage
Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
This commit is contained in:
parent
6b22e870a1
commit
7d256f0ca6
1 changed files with 15 additions and 1 deletions
16
README.md
16
README.md
|
@ -1,6 +1,6 @@
|
||||||
# [yr]
|
# [yr]
|
||||||
|
|
||||||
Get the weather delivered to your command-line.
|
Get the weather delivered to your command-line, or use as a Go package.
|
||||||
|
|
||||||
The project uses [Meteorologisk institutt]'s public API, [`LocationForecast`],
|
The project uses [Meteorologisk institutt]'s public API, [`LocationForecast`],
|
||||||
and [OpenStreetMap]'s [Nominatim] API.
|
and [OpenStreetMap]'s [Nominatim] API.
|
||||||
|
@ -30,6 +30,20 @@ yr forecast "new york" --web
|
||||||
yr now "new york" --web
|
yr now "new york" --web
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### As a package
|
||||||
|
|
||||||
|
```go
|
||||||
|
import "git.sr.ht/~timharek/yr/yr"
|
||||||
|
|
||||||
|
func weather() {
|
||||||
|
y := yr.New()
|
||||||
|
|
||||||
|
now := y.Now("bergen")
|
||||||
|
|
||||||
|
// Use the data
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Anyone can contribute to [yr]. Please refer to the [contribution guidelines].
|
Anyone can contribute to [yr]. Please refer to the [contribution guidelines].
|
||||||
|
|
Loading…
Reference in a new issue