Skip to content

Commit 0a96f2f

Browse files
author
Yo'av Moshe
committed
version 0.14.4
1 parent 192c4af commit 0a96f2f

3 files changed

Lines changed: 12 additions & 15 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wttrbar"
3-
version = "0.14.3"
3+
version = "0.14.4"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

src/main.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,17 @@ fn main() {
163163
lang.humidity(),
164164
current_condition["humidity"].as_str().unwrap()
165165
);
166-
// let request = &weather["data"]["request"][0];
167-
// let area_name = request["query"].as_str().unwrap_or("");
168-
// let region = "";
169-
// let country = "";
166+
let nearest_area = &weather["nearest_area"][0];
167+
let area_name = nearest_area["areaName"][0]["value"].as_str().unwrap();
168+
let region = nearest_area["region"][0]["value"].as_str().unwrap();
169+
let country = nearest_area["country"][0]["value"].as_str().unwrap();
170170

171-
// let location_parts: Vec<&str> = vec![area_name, region, country]
172-
// .into_iter()
173-
// .filter(|part| !part.is_empty())
174-
// .collect();
171+
let location_parts: Vec<&str> = vec![area_name, region, country]
172+
.into_iter()
173+
.filter(|part| !part.is_empty())
174+
.collect();
175175

176-
// tooltip += &format!("{}: {}\n", lang.location(), location_parts.join(", "));
176+
tooltip += &format!("{}: {}\n", lang.location(), location_parts.join(", "));
177177

178178
if args.observation_time {
179179
if let Some(obs_time) = current_condition["observation_time"].as_str() {
@@ -191,10 +191,7 @@ fn main() {
191191
let now = Local::now();
192192

193193
let today = Local::now().date_naive();
194-
let mut forecast = weather["weather"]
195-
.as_array()
196-
.cloned()
197-
.unwrap_or_default();
194+
let mut forecast = weather["weather"].as_array().unwrap().clone();
198195
forecast.retain(|item| {
199196
let item_date =
200197
NaiveDate::parse_from_str(item["date"].as_str().unwrap(), "%Y-%m-%d").unwrap();

0 commit comments

Comments
 (0)