commands icon indicating copy to clipboard operation
commands copied to clipboard

Support @CommandAlias on parent classes

Open aikar opened this issue 6 years ago • 1 comments

This should define:

/feature help
/feature foo hello
/feature foo world

with the following

@CommandAlias("feature")
public class FeatureCommand extends BaseCommand {
  @HelpCommand
  public void onHelp(CommandHelp help) { help.showHelp(); }
}

@Subcommand("foo")
public class FeatureGroup1 extends FeatureCommand {
  @Subcommand("hello")
  public void onHello() { }
}
@Subcommand("bar")
public class FeatureGroup2 extends FeatureCommand {
  @Subcommand("world")
  public void onWorld() { }
}

We need to check inheritance of the class to find @CommandAlias. This avoids duplicating it over multiple multiple classes, forcing you to use replacements to make it managed in 1 place (which is decoupled)

If we encounter multiple command aliases above the BaseCommand, they should be merged.

aikar avatar Jun 27 '18 03:06 aikar

Has this got any progress? I would find this extremely useful, especially as it would make sense to be able to add subcommands by extending the base command.

lewisakura avatar May 19 '19 12:05 lewisakura