Search in sources :

Example 1 with LegacyCommandContainer

use of org.jboss.as.cli.impl.aesh.cmd.operation.LegacyCommandContainer in project wildfly-core by wildfly.

the class HelpSupportTestCase method testCLICommands.

@Test
public void testCLICommands() throws Exception {
    CommandContextImpl ctx = (CommandContextImpl) CommandContextFactory.getInstance().newCommandContext();
    AeshCommands commands = ctx.getAeshCommands();
    for (String name : commands.getRegistry().getAllCommandNames()) {
        CLICommandContainer container = (CLICommandContainer) commands.getRegistry().getCommand(name, name);
        if (!(container.getWrappedContainer() instanceof LegacyCommandContainer) && !isAeshExtension(container.getParser().getCommand())) {
            HelpSupport.checkCommand(null, container.getParser());
            for (CommandLineParser<CLICommandInvocation> child : container.getParser().getAllChildParsers()) {
                HelpSupport.checkCommand(container.getParser(), child);
            }
        }
    }
}
Also used : LegacyCommandContainer(org.jboss.as.cli.impl.aesh.cmd.operation.LegacyCommandContainer) CLICommandInvocation(org.wildfly.core.cli.command.aesh.CLICommandInvocation) CommandContextImpl(org.jboss.as.cli.impl.CommandContextImpl) Test(org.junit.Test)

Example 2 with LegacyCommandContainer

use of org.jboss.as.cli.impl.aesh.cmd.operation.LegacyCommandContainer in project wildfly-core by wildfly.

the class CLICommandRegistry method registerHandler.

@Override
public void registerHandler(CommandHandler handler, boolean tabComplete, String... names) throws RegisterHandlerException {
    RegisterHandlerException error = null;
    for (String name : names) {
        try {
            checkExistence(name);
        } catch (CommandLineException ex) {
            if (error == null) {
                error = new RegisterHandlerException(name);
            } else {
                error.addCommand(name);
            }
        }
    }
    if (error != null) {
        throw error;
    }
    super.registerHandler(handler, tabComplete, names);
    if (tabComplete) {
        try {
            addCommandContainer(new LegacyCommandContainer(ctx, names, handler), false);
        } catch (CommandLineException | CommandLineParserException ex) {
            throw new RegisterHandlerException(ex.getLocalizedMessage());
        }
    }
}
Also used : LegacyCommandContainer(org.jboss.as.cli.impl.aesh.cmd.operation.LegacyCommandContainer) CommandLineParserException(org.aesh.command.parser.CommandLineParserException) CommandLineException(org.jboss.as.cli.CommandLineException)

Aggregations

LegacyCommandContainer (org.jboss.as.cli.impl.aesh.cmd.operation.LegacyCommandContainer)2 CommandLineParserException (org.aesh.command.parser.CommandLineParserException)1 CommandLineException (org.jboss.as.cli.CommandLineException)1 CommandContextImpl (org.jboss.as.cli.impl.CommandContextImpl)1 Test (org.junit.Test)1 CLICommandInvocation (org.wildfly.core.cli.command.aesh.CLICommandInvocation)1