Command Groups

Issue #73 open
Yusuf Ismail repo owner created an issue

Add a system to Quantum Console that allows commands to be declared as part of a group. These groups can then be manipulated at runtime (hidden, disabled etc) and can also be exposed for other usages (such as “all-commands-in-group“)

Original request

Feature request #1: I would like the ability to dynamically enable and disable commands. The way I would envision this working is that you can add an attribute to a command, or a whole static class containing commands, called something like CommandGroup("Advanced"). That will assign a group name to the commands which will be used later.

Then on QuantumConsoleProcessor you add a method like EnableCommandGroup("Advanced", false) which will take all commands in the specified group and enable/disable them. This will rebuild the command table so that the specified commands are prevented from running, and also don't display for help, it is like they don't exist. This can be used to eliminate commands that don't apply to the current context (e.g. don't work in the current game mode), and also to enable/disable debug/developer commands.

Feature request #2: I would like to be able to hide commands. Add another method to QuantumConsoleProcessor, HideCommandGroup("Unlock", true) which simply prevents the command from showing in auto-complete and the help. You can still execute the command though. You can use this to add secret commands for debugging, and also combining it with #1, to unlock a group of commands e.g. make a command called "unlock" that you can call with "unlock debug" and it unlocks those commands - you could also give it a password or whatever.

Comments (6)

  1. Yusuf Ismail reporter

    Design Ideas

    Usage

    There will be a [CommandGroup] attribute that can be applied to individual methods or to entire classes.

    This will allow you to add individual commands or entire groups of commands to a CommandGroup easily

    Note: if multiple [Command]s are on the same method, they will be locked into the same groups. A dummy method could be used to avoid this. Perhaps there is a better design refinement to allow for this

    Implementation

    There will be methods available to the QuantumConsoleProcessor that allow for setting the visibility and activity of a group. The GetCommands method will be modified to take a CommandHideState flag enum: this will contain

    • ShowDisabled
    • ShowHidden

    The suggestions system therefore will not enable either of these flags, whereas the internal command parser will enable the ShowHidden flag, enabling hidden but disabled commands to be invoked

    Current Issues

    If a command is under two groups, and one of those groups is hidden but the other is visible, will this command be classed as visible or hidden (i.e union vs intersection)

  2. Log in to comment