FEZRepacker icon indicating copy to clipboard operation
FEZRepacker copied to clipboard

Use `System.CommandLine` library for convinient CLI command parsing

Open zrckr opened this issue 4 months ago • 4 comments

Ok, this is a big one...

For more convenient development of current and future commands for the CLI, I suggest using the System.CommandLine library. This is used for the dotnet utility and provides an API for creating CLIs. It is currently in the rc stage, but its API is quite stable.

Advantages:

  • Supports many native C# types that automatically convert data (for example, enums, file and directory infos).
  • No reflection-based API.
  • Quite small (~153 KB) and no external dependencies.

Disadvantages:

  • The library currently is in preview stage (mentioned above).
  • Microsoft's documentation is still sparse, describing only the basic principles of working with the library.

For now this PR is adraft because it contains many changes. In terms of functionality, (almost) everything has remained the same (except for the help command, which is generated by the library).

A self-contained executable is compiling without errors. The only thing is that the library warns about being tailored for .NET 8.0, but (so far) it compiles fine under .NET 6.0.

Link to the documentation: System.CommandLine overview

zrckr avatar Sep 20 '25 11:09 zrckr