5 ms·
Weatherme CLI Tool
- matt-by-nature 4y agoThis is delightful! I really love how understated the README is “the cli tool that no one needs”, and also two DP on the temperature. I will clone and start using first thing in the morning. Thank you.
- cglong 4y agoCan this be marked as a Show HN?
- fishgoesblub 4y agoYou can also view the weather in the terminal with Curl using curl wttr.in
- guestbest 4y agoGetting the weather is one thing, but being to POST would be a game changer. Think of what it would do to help gardening
- culi 4y agoSome people just wanna watch the world DELETE
- noxvilleza 4y agoReminds me of `curl wttr.in` -- although slightly more verbose in some metrics.
- devjam 4y agoI had the same thought; this is in my shell RC: alias weather='f() { curl wttr.in/${1:-sydney} };f'
- Alifatisk 4y agoThis cannot be the real secret api key? https://github.com/eoin-barr/weatherme/blob/master/cmd/root.go#L87 https://github.com/eoin-barr/weatherme/blob/master/cmd/root....
- WirelessGigabit 4y agoThat function shows the state of error handling in Go.
- alexeldeib 4y agowouldn't mind a question mark for checking nil err like result in rust..
- ilyt 4y agoI'd even settle for return err if err != nil everything better than three fucking lines every time something returns err. Especially that some clown decided that apparently if err != nil { return err } is too terse and go fmt just goes back to expanding it to 3 lines...
- datalopers 4y agoWhat is an example of a better approach? Methods that throw exceptions?
- Gorath 4y agoI just don’t understand why this is better than returning an error to caller? E.g have an err return type that could be nil. This type of practice just seems to ask for undefined behavior or debugging frustration. when you finally track down this log statement, we have multiple call sites to choose from to determine where this free form log string came from. Hopefully the same generic string was not used in a separate function!
- ilyt 4y agoUh, no, it's just bad code. Don't get me wrong, error handling is verbose and annoying, but not even displaying actual error is just horrible coding practice. should be at the very least err = json.Unmarshal(weatherBody, &WeatherRes) if err != nil { fmt.Printf("error decoding weather json: %s\n",err) return } or just be function that returns that error or the weather err = json.Unmarshal(weatherBody, &WeatherRes) if err != nil { return fmt.Errorf("error decoding weather json: %s\n",err) }
- Terretta 4y agoI use(d) ansiweather with geektool: AnsiWeather is a Shell script for displaying the current weather conditions in your terminal, with support for ANSI colors and Unicode symbols. Weather data comes from the OpenWeatherMap free weather API. AnsiWeather packages are available for: OpenBSD, NetBSD, FreeBSD, Debian, Ubuntu, Homebrew https://github.com/fcambus/ansiweather https://github.com/fcambus/ansiweather // Looking for geektool alternative for arm64 w/o Rosetta.
- sramsay 4y agoI suppose this is as good a time as any to plug noaa, a CLI tool that can give you the current conditions and forecast, but also allows you to retrieve any product the US National Weather Service produces. It’s way geekier than the above, but perhaps more useful for some. https://github.com/sramsay/nowa/ https://github.com/sramsay/nowa/ (I am also the author of wu, which was a popular cli tool for the Weather Underground API. I had to discontinue that when they closed free access to their API. That was written in Go; this one is written in C).
- the-printer 4y agoThank you for wu and this too, Please enlighten me on why nowa is written in C, would you?
- sramsay 4y agoThe usual reasons, I suppose (speed, portability, ubiquity . . .) Do you mean as opposed to Go?
- yjftsjthsd-h 4y agoAs always, you should feel free to rewrite in whatever Better Language™ you prefer.
- georgeplusplus 4y agoA small suggestion. I always add the expected output to a sample input in GitHub readme. I think it helps a lot to attract any prospective users.
- behnamoh 4y agoI prefer this one: https://github.com/chubin/wttr.in https://github.com/chubin/wttr.in You gotta love terminal man!
- gabrielsroka 4y agoUsing curl, jq and api.weather.gov. See docs for more info. Use Google Maps or equivalent to get lat long. # Set this: latlong='33.7737,-118.1365' url=$(curl -sS "https://api.weather.gov/points/$latlong" | jq -r '.properties.forecastHourly') curl -sS "$url" | jq -r '.properties | .periods[0].temperature, .generatedAt' Using Python. import requests # Set this: latlong = '33.7737,-118.1365' session = requests.Session() url = session.get('https://api.weather.gov/points/' + latlong).json()['properties']['forecastHourly'] f = session.get(url).json()['properties'] print(f['periods'][0]['temperature']) print(f['generatedAt'])
- FrostKiwi 4y agoHow does this compare to long standing CLI oriented web services like https://github.com/chubin/wttr.in https://github.com/chubin/wttr.in ?
- mixcocam 4y agoOr you can just use this and avoid installing a script to check the weather! https://github.com/chubin/wttr.in https://github.com/chubin/wttr.in
- worldsavior 4y agowttr.in is pretty good, as it also doesn't require another program. But this is nice too.