-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BLOCKED] update System.CommandLine #7559
base: main
Are you sure you want to change the base?
Conversation
|
||
// Hook so we can cancel and exit when ctrl+c is pressed. | ||
var cancellationTokenSource = new CancellationTokenSource(); | ||
Console.CancelKeyPress += (sender, e) => |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7559 +/- ##
=======================================
Coverage 96.54% 96.54%
=======================================
Files 1454 1454
Lines 352505 352505
Branches 11478 11478
=======================================
+ Hits 340329 340331 +2
+ Misses 9262 9260 -2
Partials 2914 2914 |
Edit: this PR is blocked until NuGet/NuGet.Client#6236 gets merged (ETA is April).
This PR consists of: