From 3b7856e30a158bb4b40cfd4985b9cb636b2e6c57 Mon Sep 17 00:00:00 2001 From: Thomas Ardal Date: Thu, 30 Nov 2023 12:44:22 +0100 Subject: [PATCH] Added option to skip project --- src/NuPU/UpdateCommand.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/NuPU/UpdateCommand.cs b/src/NuPU/UpdateCommand.cs index b849926..35ca6ca 100644 --- a/src/NuPU/UpdateCommand.cs +++ b/src/NuPU/UpdateCommand.cs @@ -75,9 +75,11 @@ public override async Task ExecuteAsync(CommandContext context, UpdateComma if (packages.Count() == 0) continue; var projectFileResults = new Dictionary(); + var skip = false; foreach (var package in packages.Where(p => string.IsNullOrWhiteSpace(updateCommandSettings.Package) || string.Equals(p.Id, updateCommandSettings.Package, StringComparison.OrdinalIgnoreCase))) { + if (skip) break; NuGetVersion nugetVersion = null; if (VersionRange.TryParse(package.Version, out VersionRange versionRange)) { @@ -137,12 +139,19 @@ public override async Task ExecuteAsync(CommandContext context, UpdateComma var currentVersionString = $"{nugetVersion.OriginalVersion} (current)"; choices.Add(currentVersionString); choices.AddRange(versionsToShow.OrderBy(v => v).Select(v => v.ToString())); + var skipString = "Skip project"; + choices.Add(skipString); showUpToDate = false; AnsiConsole.MarkupLine(NeedsUpdate); var choice = AnsiConsole.Prompt(new SelectionPrompt().PageSize(10).AddChoices(choices.ToArray())); if (choice == currentVersionString) continue; + if (choice == skipString) + { + skip = true; + break; + } var dotnet = new ProcessStartInfo("dotnet", $"add package {package.Id} -v {choice} -s {source.SourceUri}") {