Skip to content

Commit

Permalink
Added option to skip project
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasArdal committed Nov 30, 2023
1 parent f603f5b commit 3b7856e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/NuPU/UpdateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ public override async Task<int> ExecuteAsync(CommandContext context, UpdateComma
if (packages.Count() == 0) continue;

var projectFileResults = new Dictionary<string, string>();
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))
{
Expand Down Expand Up @@ -137,12 +139,19 @@ public override async Task<int> 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<string>().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}")
{
Expand Down

0 comments on commit 3b7856e

Please sign in to comment.