Skip to content

Commit

Permalink
cli: report weather station
Browse files Browse the repository at this point in the history
  • Loading branch information
pcarrier committed Feb 13, 2025
1 parent e016ac4 commit b1442a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions cli/Response.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ struct Response {
std::optional<float> latitude;
std::optional<float> longitude;
std::optional<std::string> tz;
std::optional<std::string> weather;
};
3 changes: 2 additions & 1 deletion cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Response parse_ident_json(const std::string& jsonStr) {
maybe_set_float("latitude", result.latitude);
maybe_set_float("longitude", result.longitude);
maybe_set_string("tz", result.tz);

maybe_set_string("weather", result.weather);
return result;
} catch (const nlohmann::json::parse_error& e) {
throw FetchError(std::string("Failed to parse JSON: ") + e.what());
Expand Down Expand Up @@ -108,6 +108,7 @@ void print_json(const std::optional<Response>& v4, const std::optional<Response>
if (r.hostname) j["hostname"] = *r.hostname;
if (r.asn) j["asn"] = *r.asn;
if (r.aso) j["aso"] = *r.aso;
if (r.weather) j["weather"] = *r.weather;
if (r.continent) j["continent"] = *r.continent;
if (r.country) j["country"] = *r.country;
if (r.cc) j["cc"] = *r.cc;
Expand Down

0 comments on commit b1442a4

Please sign in to comment.