Skip to content

Improve usage in command help #363

@willkroboth

Description

@willkroboth

Description

Currently, when you build a large branching command (pretty easy with a CommandTree) the usage given by /help can end up looking like this:

--------- Help: /configcommands -----------------
A command for interacting with the ConfigCommands system
Description: Different systems are accessed using their keywords. 
For help with a specific section, use /configcommands help <section>
Usage: 
- /configcommands 
- /configcommands <help> 
- /configcommands <help> <functions> 
- /configcommands <help> <build> 
- /configcommands <help> <reload> 
- /configcommands <help> <debug> 
- /configcommands <functions> 
- /configcommands <functions> <addOn> <internalArgument> <static> <function> 
- /configcommands <functions> <addOn> <internalArgument> <nonStatic> <function> 
- /configcommands <build> 
- /configcommands <reload> <greet> 
- /configcommands <reload> <greet> <message> 
- /configcommands <reload> <echo> <string> 
- /configcommands <debug> 
- /configcommands <debug> <enable> 
- /configcommands <debug> <disable> 
- /configcommands <debug> <local> <command> 
- /configcommands <debug> <local> <command> <enable> 
- /configcommands <debug> <local> <command> <disable>

In my example here, I would prefer the help look like this, highlighting and refining the most important command paths the user should care about:

--------- Help: /configcommands -----------------
A command for interacting with the ConfigCommands system
Description: Different systems are accessed using their keywords. 
For help with a specific section, use /configcommands help <section>
Usage: 
- /configcommands help
- /configcommands help <section>
- /configcommands <functions> 
- /configcommands <functions> <addOn> <internalArgument> <(non)static> <function> 
- /configcommands <build> 
- /configcommands <reload> <commandName> <arguments> 
- /configcommands <debug> 
- /configcommands <debug> <enable/disable> 
- /configcommands <debug> <local> <command> 
- /configcommands <debug> <local> <command> <enable/disable> 

Expected code

The default usage generation probably works fine for most users, but just like the default A Mojang provided command. message, it would be nice if it could be overridden. Perhaps something like this:

new CommandTree("configcommands")
        .withUsage(
            "configcommands help",
            "configcommands help <section>",
            "configcommands <functions>",
            "configcommands <functions> <addOn> <internalArgument> <(non)static> <function>",
            "configcommands <build>",
            "configcommands <reload> <commandName> <arguments>",
            "configcommands <debug>",
            "configcommands <debug> <enable/disable>",
            "configcommands <debug> <local> <command>",
            "configcommands <debug> <local> <command> <enable/disable>"
        )

Extra details

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestimplemented for next releaseThis has been implemented in the current dev build for the next public release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions