dotnet / command-line-api

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

`whatif` #2454

Open KathleenDollard opened 2 months ago

KathleenDollard commented 2 months ago

Consider an optional subsystem in the Invocation phase that allows a standard whatif mechanism.

The expected usage is to replace diagramming where a simple understanding and confirmation of the parse result is needed. This can be important to CLI users and CLI authors. It may also be useful in tests, which is why a machine friendly output like JSON may be helpful.

Diagramming is still important to understand nuances of why parsing fails when it does not work as expected.

Proposed sample output:

ApplicationName.exe

Command: 
   Grandparent parent command

Arguments:
   Arg1: arg1 value
   Arg2: arg2 value

Options:
   Option1: value
   Option2: 41             Error: 41 is not the correct value

This subsystem could either be part of the standard Powderhouse subsystems or a separate package.

Balkoth commented 2 months ago

Whatif there finally was a release?