public static bool IsLatestVersion() { var currentVersion = CliHelper.GetCurrentVersion(); if (currentVersion == new Version(1, 0, 0, 0)) { return(true); } var latestVersion = GetLatestVersion(); return(latestVersion is null || !latestVersion.GreaterThan(currentVersion)); }
private static void HandleVersionOption() { System.Console.WriteLine(CliHelper.GetCurrentVersion().ToString()); if (CodingRulesUpdaterVersionHelper.IsLatestVersion()) { return; } var latestVersion = CodingRulesUpdaterVersionHelper.GetLatestVersion() !; System.Console.WriteLine(string.Empty); System.Console.WriteLine($"Version {latestVersion} of ATC-Coding-Rules-Updater is available!"); System.Console.WriteLine(string.Empty); System.Console.WriteLine("To update run the following command:"); System.Console.WriteLine(" dotnet tool update --global atc-coding-rules-updater"); }
private static void HandleVersionOption() { System.Console.WriteLine(CliHelper.GetCurrentVersion().ToString()); if (CliVersionHelper.IsLatestVersion()) { return; } var latestVersion = CliVersionHelper.GetLatestVersion() !; System.Console.WriteLine(string.Empty); System.Console.WriteLine($"Version {latestVersion} of ATC-Rest-Api-Generator is available!"); System.Console.WriteLine(string.Empty); System.Console.WriteLine("To update run the following command:"); System.Console.WriteLine(" dotnet tool update --global atc-rest-api-generator"); }
public static void PrintUpdateInfoIfNeeded( ILogger logger) { if (IsLatestVersion()) { return; } var currentVersion = CliHelper.GetCurrentVersion(); var latestVersion = GetLatestVersion() !; logger.LogWarning($"Version {latestVersion} of ATC-Coding-Rules-Updater is available!"); logger.LogWarning($"You are running version {currentVersion}"); logger.LogWarning(string.Empty); logger.LogWarning("To update run the following command:"); logger.LogWarning(" dotnet tool update --global atc-coding-rules-updater"); logger.LogWarning(string.Empty); }