Cysharp / ConsoleAppFramework

Zero Dependency, Zero Overhead, Zero Reflection, Zero Allocation, AOT Safe CLI Framework powered by C# Source Generator.
MIT License
1.54k stars 88 forks source link

Fixes #124 - Created alias variable by allowing multiple command attributes #125

Open BlackPhlox opened 1 month ago

BlackPhlox commented 1 month ago

First draft for how to fix #124.

Created alias variable by allowing multiple command attributes, generation changes and test that passes.

BlackPhlox commented 1 month ago

CommandAliasWithRoot currently fails as it generates a switch case for which there are no switches generated at that location due to being root.

neuecc commented 4 weeks ago

Thank you, I ran the code and checked it.

The choice to allow setting multiple Commands is OK. Since I think only some users will use it, it's good that it doesn't change for normal use cases.

Regarding the code: Having the emit for aliases in EmitRunBody feels a bit off, I feel there might be a more appropriate place for it. Also, the output code unnecessarily indented the case statements. string[] Aliases probably won't be Incremental, so an Incremental test is needed (see IncrementalGeneratorTest).