Correct stdout, updating lib and some clippy clean
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2023-07-30 18:13:42 +02:00
parent fd4affdb17
commit 1affcb9d1a
10 changed files with 117 additions and 138 deletions
+12 -12
View File
@@ -6,7 +6,7 @@ mod current_weather_output_model;
mod current_weather_print_params;
mod ifconfig {
pub mod ifconfig;
pub mod ifconfig_api;
}
mod formats {
@@ -16,14 +16,14 @@ mod formats {
}
mod ip_api {
pub mod ip_api;
pub mod ip_api_api;
pub mod ip_location;
pub mod ip_location_cache;
}
mod open_meteo {
pub mod current_weather;
pub mod open_meteo;
pub mod open_meteo_api;
}
use billboard::{Alignment, Billboard};
@@ -36,9 +36,9 @@ use cli::Arguments;
use coords::Coordinates;
use current_weather_extractor::CurrentWeatherExtractor;
use current_weather_print_params::CurrentWeatherPrintParams;
use ifconfig::ifconfig::extract_public_ip;
use ip_api::ip_api::extract_coords_and_city;
use open_meteo::open_meteo::request_current_weather;
use ifconfig::ifconfig_api::extract_public_ip;
use ip_api::ip_api_api::extract_coords_and_city;
use open_meteo::open_meteo_api::request_current_weather;
fn main() {
let opts = Arguments::from_args();
@@ -98,8 +98,8 @@ fn main() {
let ip_location;
let cache_ip_location = get_from_cache(&ip);
if cache_ip_location.is_some() {
ip_location = cache_ip_location.unwrap();
if let Some(cache_ip_location) = cache_ip_location {
ip_location = cache_ip_location;
} else {
let ip_location_res = extract_coords_and_city(&ip);
ip_location = ip_location_res.unwrap_or_else(|_| {
@@ -130,7 +130,7 @@ fn main() {
format = DataFormat::JSON;
}
let print_params = CurrentWeatherPrintParams::new(
let print_params = CurrentWeatherPrintParams {
all,
is_day,
temperature,
@@ -141,7 +141,7 @@ fn main() {
include_coords,
include_city,
format,
);
};
let current_weather_printer =
CurrentWeatherExtractor::new(current_weather, print_params, coordinates, city);
@@ -151,9 +151,9 @@ fn main() {
.text_alignment(Alignment::Left)
.box_alignment(Alignment::Left)
.build()
.eprint(output.to_string());
.print(output.to_string());
} else {
println!("{}", output.to_string());
println!("{}", output);
}
}
}