mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-18 09:53:43 -05:00
Fixed OpenSSL build errors on Alpine and changed the logging a bit
This commit is contained in:
10
src/check.rs
10
src/check.rs
@@ -1,12 +1,9 @@
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use chrono::Local;
|
||||
|
||||
use crate::{
|
||||
debug,
|
||||
docker::get_images_from_docker_daemon,
|
||||
image::Image,
|
||||
info,
|
||||
registry::{check_auth, get_latest_digests, get_token},
|
||||
utils::{new_reqwest_client, unsplit_image, CliConfig},
|
||||
};
|
||||
@@ -32,7 +29,6 @@ where
|
||||
}
|
||||
|
||||
pub async fn get_all_updates(options: &CliConfig) -> Vec<(String, Option<bool>)> {
|
||||
let start = Local::now().timestamp_millis();
|
||||
let local_images = get_images_from_docker_daemon(options).await;
|
||||
let mut image_map: HashMap<String, Option<String>> = HashMap::with_capacity(local_images.len());
|
||||
for image in &local_images {
|
||||
@@ -81,12 +77,6 @@ pub async fn get_all_updates(options: &CliConfig) -> Vec<(String, Option<bool>)>
|
||||
None => result.push((img, None)),
|
||||
}
|
||||
});
|
||||
let end = Local::now().timestamp_millis();
|
||||
info!(
|
||||
"✨ Checked {} images in {}ms",
|
||||
local_images.len(),
|
||||
end - start
|
||||
);
|
||||
result
|
||||
}
|
||||
|
||||
|
||||
11
src/main.rs
11
src/main.rs
@@ -1,5 +1,6 @@
|
||||
#[cfg(feature = "cli")]
|
||||
use check::{get_all_updates, get_update};
|
||||
use chrono::Local;
|
||||
use clap::{Parser, Subcommand};
|
||||
#[cfg(feature = "cli")]
|
||||
use formatting::{print_raw_update, print_raw_updates, print_update, print_updates, Spinner};
|
||||
@@ -95,13 +96,21 @@ async fn main() {
|
||||
};
|
||||
}
|
||||
None => {
|
||||
let start = Local::now().timestamp_millis();
|
||||
match *raw || cli.verbose {
|
||||
true => print_raw_updates(&get_all_updates(&cli_config).await),
|
||||
true => {
|
||||
let updates = get_all_updates(&cli_config).await;
|
||||
let end = Local::now().timestamp_millis();
|
||||
print_raw_updates(&updates);
|
||||
info!("✨ Checked {} images in {}ms", updates.len(), end - start);
|
||||
}
|
||||
false => {
|
||||
let spinner = Spinner::new();
|
||||
let updates = get_all_updates(&cli_config).await;
|
||||
spinner.succeed();
|
||||
let end = Local::now().timestamp_millis();
|
||||
print_updates(&updates, icons);
|
||||
info!("✨ Checked {} images in {}ms", updates.len(), end - start);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user