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

Branch command name not showing up in help text.

Open DarthPedro opened this issue 5 years ago • 2 comments

If I have an AddBranch as follows:

                config.AddBranch("student", student =>
                {
                    student.AddCommand<StudentAddCommand>("new")
                        .WithAlias("add")
                        .WithDescription("Add new student information.")
                        .WithExample(new[] { "student", "new", "--id", "1001" });

                    student.AddCommand<StudentViewCommand>("view")
                        .WithDescription("View student information by id.")
                        .WithExample(new[] { "student", "view", "--id", "1001" });

                    student.AddCommand<StudentListCommand>("list")
                        .WithDescription("View list of students.")
                        .WithExample(new[] { "student", "list" });

                    student.AddCommand<StudentDeleteCommand>("delete")
                        .WithAlias("del")
                        .WithDescription("Remove student from list.")
                        .WithExample(new[] { "student", "delete", "--id", "1001" });
                });

The help text for this will only show a period in the COMMANDS section: USAGE: lesson [OPTIONS]

EXAMPLES: lesson student new --id 1001 lesson student view --id 1001 lesson student list lesson student delete --id 1001

OPTIONS: -h, --help Prints help information

COMMANDS: .

If however, you add a description to the student configurator, like: student.SetDescription("View, list, add or remove students."); Then you get the help text that you would expect with the command name and description: USAGE: lesson [OPTIONS]

EXAMPLES: lesson student new --id 1001 lesson student view --id 1001 lesson student list lesson student delete --id 1001

OPTIONS: -h, --help Prints help information

COMMANDS: student View, list, add or remove students

If no description is given, I would still expect the "student" command to show in the COMMANDS section without a description.

DarthPedro avatar Dec 11 '20 05:12 DarthPedro

@DarthPedro Thanks for reporting this. Will take a look once I have some spare time.

patriksvensson avatar Dec 11 '20 08:12 patriksvensson

@DarthPedro This seems to be a problem that originates in Spectre.Console which Spectre.Cli has a dependency on. I will try to fix this asap.

patriksvensson avatar Dec 16 '20 21:12 patriksvensson