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

Enable (param string[] something) to accept arbitrary number of parameters. #90

Closed igadmg closed 1 year ago

igadmg commented 1 year ago

For declaring some command like this [Command("run", "Run commandlet.")] public async Task RunCommandlet([Option(0)] string commandlet, [Option(1)] params string[] parameters) if last indexed parameter is params then it will accept all leftover parameters from command line

For example myprog run CommandletName param1 param2 - param1 param2 will be put to parameters array In case of myprog run CommandletName - parameters will be empty.

neuecc commented 1 year ago

I think it's ok, I'll try to merge it, thanks.

neuecc commented 1 year ago

@yatagarasu25 sorry, this feature was released in 4.2.3 but I've reverted in 4.2.4 because this test was failed. https://github.com/Cysharp/ConsoleAppFramework/commit/815cad8c25a91b1725acbfbe5cb6b29eef380149 If this feature is needed, please modify the code and also add unit tests along with it.