Open Wokarol opened 6 years ago
What about prefixing the help string with a group name? Something like:
[RegisterCommand("cube.move", Help = "cube/Move test cube")]
static void CommandMove(CommandArg[] args) { }
[RegisterCommand("cube.rotate", Help = "cube/Rotate test cube")]
static void CommandRotate(CommandArg[] args) { }
Then calling the help
command would only show "cube", and calling help cube
would list all commands in the group.
That way this is only a documentation thing, and doesn't affect how commands are processed internally. Allowing it to be an optional feature.
Either way I think you make a valid point, my projects use enough commands that the help
command isn't super useful, and I find my self using help command_name
most of the time. Having groups would likely make the command documentation more organized and easier to navigate.
That would work, especially with new autocomplete
I've added this functionality to the help
command. Example using ed
as a group:
How about adding option not to create a help menu for command? For example I have 3 objects and every object creates command with name "{name}.jump" and I don't want to show any of this groups in help menu?
So just a way to not show the command at all?
Also, why create a jump command for each object instead of having a single jump command that receives an identifier like jump {name}
?
Because I don't need to create one object to hold all objects with jump command, instead every object can add it's own command, and autocomplete supports it. When I think of it I can create static class to store objects which is good but there is still no autocomplete support.
Ah that makes sense, the groups would allow you to group all {name}
objects together or all jump
commands together. Why would you want to hide everything?
Something like:
[RegisterCommand("cube1.jump", Help = "jump/Cube1 jump")]
static void CommandJump1(CommandArg[] args) { }
[RegisterCommand("cube2.jump", Help = "jump/Cube2 jump")]
static void CommandJump2(CommandArg[] args) { }
would only show jump
(not the individual cube.jump commands) in the help list, to see both commands you would use help jump
.
By the way, you can add things to the autocomplete with Terminal.Autocomplete.Register("name")
. But I get what you're saying, you want separate commands.
Making command structure like {object}.{group}.{command} is just more logical to me.
equipment.gear.add helmet
is more logical to me than add equipment gear helmet
or equipment_add gear helmet
But after some thought jump {name}
might be more logical
I've added this functionality to the
help
command. Example usinged
as a group:
Excuse me, is this already available?
So I was asked to move this here: