spectre.console icon indicating copy to clipboard operation
spectre.console copied to clipboard

AddBranch() is never explained in the documentation

Open dlandi opened this issue 3 years ago • 5 comments

AddBranch() is never explained in the documentation.

For Instance, in your CLI Demo App:

        app.Configure(config =>
        {
            config.SetApplicationName("fake-dotnet");
            config.ValidateExamples();
            config.AddExample(new[] { "run", "--no-build" });

            // Run
            config.AddCommand<RunCommand>("run");

            // Add
            **config.AddBranch<AddSettings>("add", add =>**
            {
                add.SetDescription("Add a package or reference to a .NET project");
                add.AddCommand<AddPackageCommand>("package");
                add.AddCommand<AddReferenceCommand>("reference");
            });

dlandi avatar Dec 10 '21 09:12 dlandi

@dlandi to clarify: You are referring to the fact that branches are never really explained on the website, right?

nils-a avatar Dec 11 '21 20:12 nils-a

The AddBranch() method, itself, appears undocumented. If there is documentation for it then please let me know where.

Thanks. And great job so far on this library. I am using it in a real project.

-dennis

dlandi avatar Dec 11 '21 20:12 dlandi

The AddBranch() method, itself, appears undocumented.

I feel like I'm a bit slow today, sorry. Do you mean in-code (xml) documentation that appears in your IDE?

nils-a avatar Dec 11 '21 21:12 nils-a

OK. Here is the in-code comments for AddBranch()

image

As a newcomer to this library, I need a little more documentation. In my opinion, the explanation should go on your website since you are using it in your sample code to show how your library works.

I really can't decipher what this code is doing by the semantics. Does AddBranch add a command "link" to a command "chain"; or a branch to a tree?

A little more explanation somewhere would be helpful.

-dennis

dlandi avatar Dec 11 '21 21:12 dlandi

The requirements of a PR to address this issue is:

  • Explain the usage of AddBranch on the following page: https://spectreconsole.net/cli/composing, see:

image

Suggested fix to consider:

Consider splitting out the example into two sections, first giving a code example without the use of a branch eg:

image

And then giving a second example that uses the AddBranch method, providing an adequate explanation of what it does (eg. composition of nested commands / inherited command settings)

FrankRay78 avatar May 17 '23 11:05 FrankRay78