-
Notifications
You must be signed in to change notification settings - Fork 480
[BLOCKED] update System.CommandLine #7559
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
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.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:
|
|
@akoeplinger @JoeRobich Could you please review this PR, but wait with the merge until NuGet/NuGet.Client#6236 gets merged (this week)? |
Edit: this PR is blocked until NuGet/NuGet.Client#6236 gets merged (ETA is April).
This PR consists of: