0.1.6 • Published 10 years ago
yr-cli v0.1.6
yr-cli
Terminal json weather reports via the weather api from yr.no.
Usage
Create your .yrcli.json containing your location like in the example
yr # now
yr -h 16 # at 16:00
yr -d 1 -h 12 # tomorrow at 12:00
yr -f # 5 day forecastOutput is json. For quick usage you can pipe to json:
yr | json rain # amount of rain for the next hour
yr -f | json -a temperature # temperatures for next 5 daysUnits
Here is an example output object annotated with the standard metric units (because we just return numbers):
{
"from": "2015-12-31T15:00:00Z",
"to": "2015-12-31T16:00:00Z",
"rain": 0.7, // millimeters
"cloudiness": 100, // percent
"humidity": 95.5, // percent
"temperature": 4.1, // celcius
"wind": {
"speed": 5.2, // meters per second
"direction": 181 // degrees in direction of compass, e.g. 180 is straight south.
}
}The dates are UTC JSON date strings you can Date.parse().
Caching
In accordance with yr.no usage policies, data is cached in the cacheFile specified in your config for 10 minutes (which must be a .json file).
Installation
$ npm install yr-cli -gLicense
MIT-Licensed. See LICENSE file for details.