Skip to content

Is there a automatic included "--help" command to print all subcommands ?  #1708

Open
@genaray

Description

@genaray

I want to print all my subcommands or all commands in total, like a typical "--help" command does in most apps.
I actually need this as a string, so i can send it to my client which actually inputs the commands.

Is something like this already included ? Or do i need to craft this by myself, if so... how ?
Glad for any help due to the lack of documentation and the beta guide couldnt help me either.

Activity

baronfel

baronfel commented on Apr 12, 2022

@baronfel
Member

If you run your command via the 'default' CommandLineBuilder, one of the middleware provided handles help in the way you're describing. There's a worked example here if that helps illustrate the usage?

jonsequitur

jonsequitur commented on Apr 12, 2022

@jonsequitur
Contributor

If you want to get the help output as a string, you can use the HelpBuilder directly:
image

genaray

genaray commented on Apr 15, 2022

@genaray
Author

If you want to get the help output as a string, you can use the HelpBuilder directly: image

Thanks a lot ! This already helped :)
One little problem left, my root command has several subcommands registered. Those subcommands have options and stuff.
When i use the HelpBuilder to generate that describtion, it mentions my subcommands... but not the options of my subcommands. However i added an describtion for them.

Is there a way to use the help builder to generate a whole describtion for the whole command tree ?

jonsequitur

jonsequitur commented on Apr 15, 2022

@jonsequitur
Contributor

Not currently, but take a look at custom help layouts. These APIs are intended to enable this kind of customization.

https://docs.microsoft.com/en-us/dotnet/standard/commandline/customize-help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jonsequitur@baronfel@genaray

        Issue actions

          Is there a automatic included "--help" command to print all subcommands ? · Issue #1708 · dotnet/command-line-api