use of org.jboss.as.cli.impl.aesh.cmd.HelpCommand in project wildfly-core by wildfly.
the class CommandContextImpl method initCommands.
private void initCommands(boolean bootInvoker) throws CommandLineException, CommandLineParserException {
// aesh commands
cmdRegistry.addCommand(new VersionCommand());
cmdRegistry.addCommand(new HelpCommand(cmdRegistry));
if (!bootInvoker) {
cmdRegistry.addCommand(new ConnectCommand());
}
DeploymentCommand.registerDeploymentCommands(this, aeshCommands.getRegistry());
// aesh extensions, for now add grep to make | operator
// usable.
cmdRegistry.addThirdPartyCommand(new Grep(), Collections.emptyMap());
cmdRegistry.registerHandler(new AttachmentHandler(this), "attachment");
cmdRegistry.registerHandler(new PrefixHandler(), "cd", "cn");
if (!bootInvoker) {
cmdRegistry.registerHandler(new ClearScreenHandler(), "clear", "cls");
}
cmdRegistry.registerHandler(new CommandCommandHandler(cmdRegistry), "command");
cmdRegistry.registerHandler(new EchoDMRHandler(), "echo-dmr");
cmdRegistry.registerHandler(new HistoryHandler(), "history");
cmdRegistry.registerHandler(new LsHandler(this), "ls");
cmdRegistry.registerHandler(new ASModuleHandler(this), "module");
cmdRegistry.registerHandler(new PrintWorkingNodeHandler(), "pwd", "pwn");
cmdRegistry.registerHandler(new QuitHandler(), "quit", "q", "exit");
cmdRegistry.registerHandler(new ReadAttributeHandler(this), "read-attribute");
cmdRegistry.registerHandler(new ReadOperationHandler(this), "read-operation");
cmdRegistry.registerHandler(new ConnectionInfoHandler(), "connection-info");
// command-timeout
cmdRegistry.registerHandler(new CommandTimeoutHandler(), "command-timeout");
// variables
cmdRegistry.registerHandler(new SetVariableHandler(), "set");
cmdRegistry.registerHandler(new EchoVariableHandler(), "echo");
cmdRegistry.registerHandler(new UnsetVariableHandler(), "unset");
// deployment
cmdRegistry.registerHandler(new DeployHandler(this), true, "deploy");
cmdRegistry.registerHandler(new UndeployHandler(this), true, "undeploy");
cmdRegistry.registerHandler(new DeploymentInfoHandler(this), true, "deployment-info");
cmdRegistry.registerHandler(new DeploymentOverlayHandler(this), "deployment-overlay");
// batch commands
cmdRegistry.registerHandler(new BatchHandler(this), "batch");
cmdRegistry.registerHandler(new BatchDiscardHandler(), "discard-batch");
cmdRegistry.registerHandler(new BatchListHandler(), "list-batch");
cmdRegistry.registerHandler(new BatchHoldbackHandler(), "holdback-batch");
cmdRegistry.registerHandler(new BatchRunHandler(this), "run-batch");
cmdRegistry.registerHandler(new BatchClearHandler(), "clear-batch");
cmdRegistry.registerHandler(new BatchRemoveLineHandler(), "remove-batch-line");
cmdRegistry.registerHandler(new BatchMoveLineHandler(), "move-batch-line");
cmdRegistry.registerHandler(new BatchEditLineHandler(), "edit-batch-line");
// try-catch
cmdRegistry.registerHandler(new TryHandler(), "try");
cmdRegistry.registerHandler(new CatchHandler(), "catch");
cmdRegistry.registerHandler(new FinallyHandler(), "finally");
cmdRegistry.registerHandler(new EndTryHandler(), "end-try");
// if else
cmdRegistry.registerHandler(new IfHandler(), "if");
cmdRegistry.registerHandler(new ElseHandler(), "else");
cmdRegistry.registerHandler(new EndIfHandler(), "end-if");
// for
cmdRegistry.registerHandler(new ForHandler(), "for");
cmdRegistry.registerHandler(new DoneHandler(), "done");
// data-source
final DefaultCompleter driverNameCompleter = new DefaultCompleter(JDBCDriverNameProvider.INSTANCE);
final GenericTypeOperationHandler dsHandler = new GenericTypeOperationHandler(this, "/subsystem=datasources/data-source", null);
dsHandler.addValueCompleter(Util.DRIVER_NAME, driverNameCompleter);
// override the add operation with the handler that accepts connection props
final DataSourceAddCompositeHandler dsAddHandler = new DataSourceAddCompositeHandler(this, "/subsystem=datasources/data-source");
dsAddHandler.addValueCompleter(Util.DRIVER_NAME, driverNameCompleter);
dsHandler.addHandler(Util.ADD, dsAddHandler);
cmdRegistry.registerHandler(dsHandler, dsHandler.getCommandName());
final GenericTypeOperationHandler xaDsHandler = new GenericTypeOperationHandler(this, "/subsystem=datasources/xa-data-source", null);
xaDsHandler.addValueCompleter(Util.DRIVER_NAME, driverNameCompleter);
// override the xa add operation with the handler that accepts xa props
final XADataSourceAddCompositeHandler xaDsAddHandler = new XADataSourceAddCompositeHandler(this, "/subsystem=datasources/xa-data-source");
xaDsAddHandler.addValueCompleter(Util.DRIVER_NAME, driverNameCompleter);
xaDsHandler.addHandler(Util.ADD, xaDsAddHandler);
cmdRegistry.registerHandler(xaDsHandler, xaDsHandler.getCommandName());
cmdRegistry.registerHandler(new JDBCDriverInfoHandler(this), "jdbc-driver-info");
// rollout plan
final GenericTypeOperationHandler rolloutPlan = new GenericTypeOperationHandler(this, "/management-client-content=rollout-plans/rollout-plan", null);
rolloutPlan.addValueConverter("content", HeadersArgumentValueConverter.INSTANCE);
rolloutPlan.addValueCompleter("content", RolloutPlanCompleter.INSTANCE);
cmdRegistry.registerHandler(rolloutPlan, rolloutPlan.getCommandName());
// supported but hidden from tab-completion until stable implementation
cmdRegistry.registerHandler(new ArchiveHandler(this), false, "archive");
AtomicReference<EmbeddedProcessLaunch> embeddedServerLaunch = null;
if (!bootInvoker) {
embeddedServerLaunch = EmbeddedControllerHandlerRegistrar.registerEmbeddedCommands(cmdRegistry, this);
cmdRegistry.registerHandler(new ReloadHandler(this, embeddedServerLaunch), "reload");
cmdRegistry.registerHandler(new ShutdownHandler(this, embeddedServerLaunch), "shutdown");
}
cmdRegistry.addCommand(new SecurityCommand(this, embeddedServerLaunch));
if (!bootInvoker) {
registerExtraHandlers();
}
extLoader = new ExtensionsLoader(cmdRegistry, aeshCommands.getRegistry(), this);
}
Aggregations