Refactor: Switch from CommandLineParser to System.CommandLine (#1016)#3014
Refactor: Switch from CommandLineParser to System.CommandLine (#1016)#3014abdulrahmanhossam wants to merge 19 commits intodotnet:masterfrom
Conversation
|
@dotnet-policy-service agree |
|
When running Therefore, I though it need to fix these tests first. Other points of concern are listed below.
|
|
Thanks a lot for the detailed review and catching these points, @filzrev! I have pushed a new commit that addresses all your concerns:
The local build is completely green now. Let me know if there is anything else needed! |
…smJavascriptEngineArguments property
|
**1. Keep help display ordering Is it able to keep existing argument orders that are displayed on help? **2. Show usage examples On existing CommandLineParser implementation. 3. Missing argument mappings. When comparing 4. DashDash extra arguments supports It's not explicitly documented/tested though. But after
It it able to ignore args that are placed after |
|
Thanks for pointing these out, @filzrev! I have just pushed a commit that addresses points 3 and 4:
Regarding Points 1 (Help Ordering) and 2 (Usage Examples): Let me know what you think is best for the project! |
As far as I've confirmed. Note: I've added some additional options registrations. So it needs maping to CommandLineOptions also. Add rootCommand optionsAdditionally |
|
Thanks again for the thorough review, @filzrev and @timcassell! I have applied all the requested refinements in the latest commit:
The local build is completely green. Let me know if there are any other final touches needed before merging! |
…s, and fix serialization order
…handling for unrecognized options
|
Hi @filzrev, I have addressed all the latest feedback:
All CI tests are completely green now! ✅ Let me know if we are good to go. |
|
Hi @filzrev, Thanks for the great architectural suggestions! I have implemented both of your requests:
(Note: Since the current Everything builds perfectly and the tests are green. |
|
Hi @filzrev, @timcassell I've applied the latest suggestion to redirect the help/version output to the All CI tests are completely green across all environments! Thank you again for the thorough reviews, patience, and great architectural suggestions throughout this PR. It really helped polish the code. Let me know if there is anything else needed, otherwise, I believe this is ready for the final stamp! |
Description
This PR addresses issue #1016 by migrating the command-line argument parsing logic from the legacy
CommandLineParserto the modern and stableSystem.CommandLine(v2.0).Key Changes
CommandLineParserandMcMaster.Extensions.CommandLineUtilsdependencies.System.CommandLinepackage reference.CommandLineOptionsto define options using the new API.ConfigParserto handle the new parsing result and map it back to the options object.Testing
Fixes #1016