dotnet / dotnet/command-line-api
Explorative command line usage
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 428
- PR merge metrics
- No merged PRs in 30d
Description
I started using the project pretty early to build what I call interactive UI. You can start the console application with a global option named `--interactive`. I step in when the option is set and load available to analyze them and their options to build a menu system.
As an example think of nuget.
- Start it with 1 --interactive` and the given commands are analyzed to build up a menu.
- It prompts for `sources`, `install`, and so on. Descriptions of the commands are loaded next to their names.
- The user selects `install` using the cursor keys and hist [Enter].
- The command has a required option `-id` and requires the user to input the name of the package, confirmed with [Enter]. Here also suggestions can build up a menu to select from.
- The command has an optional option `-version`, which can be skipped using [Esc].
The result is that the full command line is displayed, so that the user can copy it for next time or learn how to call ist without the interaction, and that the build up command with its options is executed. I really enjoyed the explorable style of System.CommandLine and would love to continue using it without dirty hacks like reflection.
There are 2 things that broke my use case:
1. The `IsGlobal`-property on the `Option` class was changed to internal.
2. The `Argument`-property on the `Option` class was changed to internal.
I do not see any performance improvement - [which was the label under which the changes have been made](https://github.com/dotnet/command-line-api/pull/1510) - and currently use reflection to access the properties. I would love to use the API without dirty hacks and hope to provide a valuable use case for this great library.
Contributor guide
Assessment
This issue has not been assessed yet.