Compare commits

..

No commits in common. "7828d7c7036c804cb92d485d8dfe00dc1287b71e" and "ebf1a7726e50422499dc7bd8a5de178836bdeedf" have entirely different histories.

2 changed files with 5 additions and 23 deletions

View File

@ -3,19 +3,13 @@ use std::fmt;
use chrono::DateTime; use chrono::DateTime;
use serde::Deserialize; use serde::Deserialize;
#[derive(Deserialize, Debug)] #[derive(Deserialize)]
struct ImageDetails { struct ImageDetails {
architecture: String, architecture: String,
// os: String, os: String,
size: usize, size: usize,
} }
impl fmt::Display for ImageDetails {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[{}, {}MB]", self.architecture, self.size / 1024 / 1024)
}
}
#[derive(Deserialize)] #[derive(Deserialize)]
pub struct Images { pub struct Images {
images: Vec<ImageDetails>, images: Vec<ImageDetails>,
@ -123,22 +117,10 @@ impl Tags {
impl fmt::Display for Images { impl fmt::Display for Images {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
//architecture infos
let mut arch = String::new();
for image in &self.images {
arch.push_str(&format!("{}", image));
}
let now = chrono::Utc::now(); let now = chrono::Utc::now();
let rfc3339 = DateTime::parse_from_rfc3339(&self.last_updated).unwrap(); let rfc3339 = DateTime::parse_from_rfc3339(&self.last_updated).unwrap();
let dif = now - rfc3339.with_timezone(&chrono::Utc); let dif = now - rfc3339.with_timezone(&chrono::Utc);
write!( write!(f, "{} vor {}", self.tag_name, format_time_nice(dif))
f,
"{} vor {} {}",
self.tag_name,
format_time_nice(dif),
arch
)
} }
} }

View File

@ -63,7 +63,7 @@ impl TagList {
match &self.typ { match &self.typ {
Type::Status(_) => (), Type::Status(_) => (),
Type::Repo(tags) => match tags.next_page() { Type::Repo(tags) => match tags.next_page() {
Err(_) => return Err(Error::NoNextPage), Err(e) => return Err(Error::NoNextPage),
Ok(tags) => self.typ = Type::Repo(tags), Ok(tags) => self.typ = Type::Repo(tags),
}, },
} }
@ -75,7 +75,7 @@ impl TagList {
match &self.typ { match &self.typ {
Type::Status(_) => (), Type::Status(_) => (),
Type::Repo(tags) => match tags.prev_page() { Type::Repo(tags) => match tags.prev_page() {
Err(_) => return Err(Error::NoPrevPage), Err(e) => return Err(Error::NoPrevPage),
Ok(tags) => self.typ = Type::Repo(tags), Ok(tags) => self.typ = Type::Repo(tags),
}, },
} }