nicer formatting for TagList
All checks were successful
continuous-integration/woodpecker the build was successful

This commit is contained in:
Thomas Eppers 2021-11-01 13:18:05 +01:00
parent 0ace41f545
commit a41197562b

View File

@ -69,6 +69,11 @@ impl Tag {
for image in self.details.iter().skip(1) { for image in self.details.iter().skip(1) {
arch.push_str(&format!(", {}", image)); arch.push_str(&format!(", {}", image));
} }
let arch = if !arch.is_empty() {
format!(" [{}]", arch)
} else {
String::new()
};
let dif = match &self.last_updated { let dif = match &self.last_updated {
None => "".to_string(), None => "".to_string(),
@ -76,10 +81,12 @@ impl Tag {
let now = chrono::Utc::now(); let now = chrono::Utc::now();
let rfc3339 = DateTime::parse_from_rfc3339(last_updated).unwrap(); let rfc3339 = DateTime::parse_from_rfc3339(last_updated).unwrap();
let dif = now - rfc3339.with_timezone(&chrono::Utc); let dif = now - rfc3339.with_timezone(&chrono::Utc);
format_time_nice(dif) format!(" vor {}", format_time_nice(dif))
} }
}; };
format!("{} vor {} [{}]", self.name, dif, arch)
if dif.is_empty() {}
format!("{}{}{}", self.name, dif, arch)
} }
} }