dotnet / command-line-api

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

Some naming and organizational issues #2348

Open KathleenDollard opened 4 months ago

KathleenDollard commented 4 months ago

What seems about right

Symbols, options, arguments, and commands

Overlapping concepts: RootCommand, CliConfiguration and the Parser

These three things work together to define what ParseOperation does. Consider nmaking Parser an instance that contains configuration information and a RootCommand.

This is similar to argparse.

The configuration properties could be directly on the parser.

The rootcommand could contain methods that allow customization of the RootCommand that delegates to the Command instance. The concept of a RootCommand has been confusing to some, especially needing to add a command when the options and arguments appeared to be on the application.

A similar outcome would occur if Parser inherited from CliCommand, but that feels a bit weird.

Unclear concepts: Pipeline (new in Powderhouse)

The pipeline is how you will access full feature behavior, like the behavior you have today in System.CommandLine. For most users, it will be the most common way of accessing System.CommandLine behavior. Pipeline does not convey that concept.

Consider renaming to Cli and having Cli be the standard full featured CLI. Have another class named EmptyCli if folks wanted to start from an empty pipeline.