mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-18 01:43:41 -05:00
Show unknown when image tag does not exist
This commit is contained in:
@@ -103,7 +103,6 @@ impl Image {
|
||||
}
|
||||
}
|
||||
|
||||
/// Compares remote digest of the image with its local digests to determine if it has an update or not
|
||||
pub fn has_update(&self) -> Status {
|
||||
if self.error.is_some() {
|
||||
Status::Unknown(self.error.clone().unwrap())
|
||||
@@ -190,7 +189,7 @@ impl Image {
|
||||
},
|
||||
time: self.time_ms,
|
||||
server: None,
|
||||
status: Status::Unknown(String::new()),
|
||||
status: has_update,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,23 +78,29 @@ impl Version {
|
||||
}
|
||||
|
||||
pub fn to_status(&self, base: &Self) -> Status {
|
||||
if self.major == base.major {
|
||||
if self.major > base.major {
|
||||
Status::UpdateMajor
|
||||
} else if self.major == base.major {
|
||||
match (self.minor, base.minor) {
|
||||
(Some(a_minor), Some(b_minor)) => {
|
||||
if a_minor == b_minor {
|
||||
if a_minor > b_minor {
|
||||
Status::UpdateMinor
|
||||
} else if a_minor == b_minor {
|
||||
match (self.patch, base.patch) {
|
||||
(Some(a_patch), Some(b_patch)) => {
|
||||
if a_patch == b_patch {
|
||||
if a_patch > b_patch {
|
||||
Status::UpdatePatch
|
||||
} else if a_patch == b_patch {
|
||||
Status::UpToDate
|
||||
} else {
|
||||
Status::UpdatePatch
|
||||
Status::Unknown(format!("Tag {} does not exist", base))
|
||||
}
|
||||
}
|
||||
(None, None) => Status::UpToDate,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
} else {
|
||||
Status::UpdateMinor
|
||||
Status::Unknown(format!("Tag {} does not exist", base))
|
||||
}
|
||||
}
|
||||
(None, None) => Status::UpToDate,
|
||||
@@ -104,7 +110,7 @@ impl Version {
|
||||
),
|
||||
}
|
||||
} else {
|
||||
Status::UpdateMajor
|
||||
Status::Unknown(format!("Tag {} does not exist", base))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user