changed formatting of output of image details

This commit is contained in:
Thomas Eppers 2021-10-17 00:12:31 +02:00
parent 0a844c42ee
commit 0edfd45d38

View File

@ -13,7 +13,7 @@ struct ImageDetails {
impl fmt::Display for ImageDetails {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[{}, {}MB]", self.architecture, self.size / 1024 / 1024)
write!(f, "{}|{}MB", self.architecture, self.size / 1024 / 1024)
}
}
@ -122,16 +122,19 @@ impl fmt::Display for Images {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
//architecture infos
let mut arch = String::new();
for image in &self.images {
for image in self.images.iter().take(1) {
arch.push_str(&format!("{}", image));
}
for image in self.images.iter().skip(1) {
arch.push_str(&format!(", {}", image));
}
let now = chrono::Utc::now();
let rfc3339 = DateTime::parse_from_rfc3339(&self.last_updated).unwrap();
let dif = now - rfc3339.with_timezone(&chrono::Utc);
write!(
f,
"{} vor {} {}",
"{} vor {} [{}]",
self.tag_name,
format_time_nice(dif),
arch