dotnet / command-line-api

Command line parsing, invocation, and rendering of terminal output.
https://github.com/dotnet/command-line-api/wiki
MIT License
3.41k stars 382 forks source link

Integration with Microsoft.Extensions.Configuration.Commandline? #572

Open johnknoop opened 5 years ago

johnknoop commented 5 years ago

The Microsoft.Extensions.Configuration.Commandline extension populates app configuration from command line arguments. However it has no support for things like validation or displaying help to the user. Is there a chance this tool can be integrated, so that if you enable command line config using config.AddCommandLine<MyOptions>(args), it will validate the arguments based on the shape of MyOptions, and also display help if the user runs my.exe --help?

mnieto commented 3 years ago

Microsoft.Extensions.Configuration is a powerful tool with the advantage of layered configurations: file, command-line, environment,.. But it lacks of a powerful commandline parser. There are some very good tools for this. I like these, but there are more good options:

I think this tools should integrate into Microsoft.Extensions.Configuration the same way that logging libraries like Serilog integrates with Microsoft.Extensions.Logging

This way we would have a rich offer of implementations but a good integration with other configuration layers

jonsequitur commented 3 years ago

Related: #1058