🚧 Add unstable version indicator.

This commit is contained in:
Kolosov Alexandr 2024-12-10 19:10:17 +05:00
parent 28b4480f30
commit 1bc1af71c9
3 changed files with 9 additions and 2 deletions

View File

@ -13,6 +13,7 @@ public static class VersionExtensions
VersionType.Candidate => "󰑣", VersionType.Candidate => "󰑣",
VersionType.Canary => "󱗆", VersionType.Canary => "󱗆",
VersionType.Next => "󰒭", VersionType.Next => "󰒭",
VersionType.Unstable => "󱓉",
_ => "" _ => ""
}; };

View File

@ -3,6 +3,7 @@ namespace TUI.Controls.Components;
public enum VersionType public enum VersionType
{ {
Convention, Convention,
Unstable,
Release, Release,
Candidate, Candidate,
Canary, Canary,

View File

@ -21,6 +21,11 @@ public class Version
Major = Convert.ToInt32(parts[0].RemoveVersionPrefix()); Major = Convert.ToInt32(parts[0].RemoveVersionPrefix());
if (version.StartsWith("^"))
{
Type = VersionType.Unstable;
}
if (parts.Length == 1) if (parts.Length == 1)
{ {
return; return;
@ -44,7 +49,7 @@ public class Version
not null when extension.Contains("alpha") => VersionType.Alpha, not null when extension.Contains("alpha") => VersionType.Alpha,
not null when extension.Contains("canary") => VersionType.Canary, not null when extension.Contains("canary") => VersionType.Canary,
not null when extension.Contains("next") => VersionType.Next, not null when extension.Contains("next") => VersionType.Next,
_ => VersionType.Release _ => version.StartsWith("^") ? VersionType.Unstable : VersionType.Release
}; };
} }
} }