Skip to content

Conversation

@adamsitnik
Copy link
Member

@adamsitnik adamsitnik commented Feb 3, 2025

Edit: this PR is blocked until NuGet/NuGet.Client#6236 gets merged (ETA is April).

This PR consists of:

@adamsitnik adamsitnik requested a review from a team as a code owner February 3, 2025 09:49

// Hook so we can cancel and exit when ctrl+c is pressed.
var cancellationTokenSource = new CancellationTokenSource();
Console.CancelKeyPress += (sender, e) =>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now being performed out of the box by System.CommandLine. All you need it to pass the cancellation token in SetAction to given async method

var rootCommand = DiffCommand.CreateCommandLineOptions();
rootCommand.Handler = CommandHandler.Create(new DiffCommand.Handler(RunAsync));

// Parse the incoming args so we can give warnings when deprecated options are used.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not able to find any other usage of Program.RunAsync so I've assumed that it's most likely some leftover and removed it.

FWIW if there will be any parsing errors detected, the Parse(args).InvokeAsync() call is going to get them printed to output and also return error code.

@codecov
Copy link

codecov bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.83%. Comparing base (f0b5b10) to head (8dc9d0e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7559      +/-   ##
==========================================
- Coverage   96.83%   96.83%   -0.01%     
==========================================
  Files        1215     1215              
  Lines      307561   307561              
  Branches     9513     9513              
==========================================
- Hits       297842   297838       -4     
- Misses       7379     7383       +4     
  Partials     2340     2340              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@adamsitnik adamsitnik marked this pull request as draft February 6, 2025 11:22
@adamsitnik adamsitnik changed the title update System.CommandLine [BLOCKED] update System.CommandLine Feb 6, 2025
@adamsitnik adamsitnik marked this pull request as ready for review April 14, 2025 12:06
@adamsitnik
Copy link
Member Author

@akoeplinger @JoeRobich Could you please review this PR, but wait with the merge until NuGet/NuGet.Client#6236 gets merged (this week)?

@ViktorHofer ViktorHofer merged commit 729249e into dotnet:main Apr 14, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants