JorelAli / CommandAPI

A Bukkit/Spigot API for the command UI introduced in Minecraft 1.13

Home Page:https://commandapi.jorel.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve usage in command help

willkroboth opened this issue · comments

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

Implemented in 9.0.2