MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / is_newer_minor_version

Function is_newer_minor_version

src/cloud.rs:283–297  ·  view source on GitHub ↗

Returns true if `latest` is a newer version than `current` AND the difference is at least a minor version bump (patch-only bumps return false). Used by the CLI version warning to avoid nagging on patch releases.

(current: &str, latest: &str)

Source from the content-addressed store, hash-verified

281///
282/// Used by the CLI version warning to avoid nagging on patch releases.
283pub fn is_newer_minor_version(current: &str, latest: &str) -> bool {
284 fn parse(v: &str) -> Option<(u64, u64)> {
285 let base = v.split_once('-').map_or(v, |(b, _)| b);
286 let mut parts = base.split('.');
287 let major = parts.next()?.parse().ok()?;
288 let minor = parts.next()?.parse().ok()?;
289 Some((major, minor))
290 }
291
292 is_newer_version(current, latest)
293 && match (parse(current), parse(latest)) {
294 (Some(c), Some(l)) => l > c,
295 _ => true,
296 }
297}
298
299/// How tracedecay was installed, detected from the binary path.
300pub enum InstallMethod {

Callers 3

silent_reinstall_actionFunction · 0.85
check_for_updateFunction · 0.85
check_version_updateMethod · 0.85

Calls 2

is_newer_versionFunction · 0.85
parseFunction · 0.70

Tested by

no test coverage detected