command-line-api
command-line-api copied to clipboard
Command line parsing, invocation, and rendering of terminal output.
This fixes #2621. It ensures that an option with a pre-action is still invoked if it has a default value but the option is not specified on the command line.
Say there is an QuietOption which is a boolean and has some action associated with it. If --quiet is specified on the command line, the associated action gets added to...
The sorting logic done here when building the default help text from the list of completions is backward: https://github.com/dotnet/dotnet/blob/2db1f5ee2bdda2e8d873769325fabede32e420e0/src/command-line-api/src/System.CommandLine/Option.cs#L142 Since the ThenBy is on the Label, the resulting sorted collection...
`Argument.Arity` modify internal state on first get access: https://github.com/dotnet/command-line-api/blob/7a5ab9e32c4a8a66b925b9380408a6847e3fd098/src/System.CommandLine/Argument.cs#L35-L43 This behavior can be problematic with debugger. As debugger display value for property it would be fixed with possibly incorrect value....
The documentation (https://learn.microsoft.com/en-us/dotnet/standard/commandline/how-to-customize-help) shows that when the user wants to customize the help he needs to write a lot of unnecessary code. Create a class which in inherited from `SynchronousCommandLineAction...
In the code below, running (with SDK 10.0.100-rc.1.25451.107) ``` dotnet run ./TestOne.cs 12 23 34 --dats ab bc cd ``` Leads to an exception being thrown ``` Unhandled exception. System.InvalidOperationException:...
Hi team, while building .NET apps (console, WPF, Windows-Service) on top of System.CommandLine, I often combine it with Microsoft.Extensions.Hosting. Today each app must: • parse args manually, • inject ParseResult...
Not sure if this is a bug, but it's confusing. I have an `Argument inputArg` which has a validator and this argument is on a command which also has a...
If the default or custom parser for an `Option` adds an error, its `Validators` are still run. This is a problem because an exception will be thrown when a validator...
When migrating to 2.0 beta 5, the `ParseResult.HasOption` is not there any more, and seems not mentioned in the migration guide, is there alternative for it? I use it to...