From 1bc1af71c9508b608da73feee0466bd6ea0c9e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=9A=D0=BE=D0=BB=D0=BE=D1=81=D0=BE=D0=B2?= Date: Tue, 10 Dec 2024 19:10:17 +0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Add=20unstable=20version=20indic?= =?UTF-8?q?ator.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/TUI/Controls/Components/VersionExtensions.cs | 3 ++- src/TUI/Controls/Components/VersionType.cs | 1 + src/TUI/Domain/Version.cs | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/TUI/Controls/Components/VersionExtensions.cs b/src/TUI/Controls/Components/VersionExtensions.cs index 5de4afa..9fcf3e6 100644 --- a/src/TUI/Controls/Components/VersionExtensions.cs +++ b/src/TUI/Controls/Components/VersionExtensions.cs @@ -13,9 +13,10 @@ public static class VersionExtensions VersionType.Candidate => "󰑣", VersionType.Canary => "󱗆", VersionType.Next => "󰒭", + VersionType.Unstable => "󱓉", _ => "" }; - + public static string Colorize(this VersionStatus versionStatus, string value) => versionStatus switch { diff --git a/src/TUI/Controls/Components/VersionType.cs b/src/TUI/Controls/Components/VersionType.cs index a7fac98..2030c01 100644 --- a/src/TUI/Controls/Components/VersionType.cs +++ b/src/TUI/Controls/Components/VersionType.cs @@ -3,6 +3,7 @@ namespace TUI.Controls.Components; public enum VersionType { Convention, + Unstable, Release, Candidate, Canary, diff --git a/src/TUI/Domain/Version.cs b/src/TUI/Domain/Version.cs index 8ac98d3..7fc8fac 100644 --- a/src/TUI/Domain/Version.cs +++ b/src/TUI/Domain/Version.cs @@ -21,6 +21,11 @@ public class Version Major = Convert.ToInt32(parts[0].RemoveVersionPrefix()); + if (version.StartsWith("^")) + { + Type = VersionType.Unstable; + } + if (parts.Length == 1) { return; @@ -44,7 +49,7 @@ public class Version not null when extension.Contains("alpha") => VersionType.Alpha, not null when extension.Contains("canary") => VersionType.Canary, not null when extension.Contains("next") => VersionType.Next, - _ => VersionType.Release + _ => version.StartsWith("^") ? VersionType.Unstable : VersionType.Release }; } } \ No newline at end of file