command_terminal icon indicating copy to clipboard operation
command_terminal copied to clipboard

Command groups idea

Open Wokarol opened this issue 7 years ago • 10 comments

So I was asked to move this here:

•Can you add something like "command groups" so when I have bunch of objects with similar commands like "testcube.jump" they won't show in help menu?

Wokarol avatar Aug 14 '18 07:08 Wokarol

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.

stillwwater avatar Aug 14 '18 12:08 stillwwater

That would work, especially with new autocomplete

Wokarol avatar Aug 17 '18 09:08 Wokarol

I've added this functionality to the help command. Example using ed as a group:

screenshot

stillwwater avatar Aug 17 '18 17:08 stillwwater

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?

Wokarol avatar Aug 17 '18 17:08 Wokarol

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}?

stillwwater avatar Aug 17 '18 17:08 stillwwater

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.

Wokarol avatar Aug 17 '18 17:08 Wokarol

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.

stillwwater avatar Aug 17 '18 17:08 stillwwater

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

Wokarol avatar Aug 17 '18 18:08 Wokarol

But after some thought jump {name} might be more logical

Wokarol avatar Aug 17 '18 18:08 Wokarol

I've added this functionality to the help command. Example using ed as a group:

screenshot

Excuse me, is this already available?

AmAutoma avatar Jun 01 '19 17:06 AmAutoma