registerCommand method

void registerCommand (
  1. String commandName,
  2. CommandHandlerFunction commandHandler,
  3. {PassHandlerFunction beforeHandler,
  4. AfterHandlerFunction afterHandler}
)

Registers command with given commandName. Allows to specify command specific before and after command execution callbacks

Implementation

void registerCommand(String commandName, CommandHandlerFunction commandHandler, {PassHandlerFunction? beforeHandler, AfterHandlerFunction? afterHandler}) {
  this._commandEntities.add(BasicCommandHandler(commandName, commandHandler, beforeHandler: beforeHandler, afterHandler: afterHandler));

  // TODO: That is not most efficient way
  this._commandEntities.sort((a, b) => -a.name.compareTo(b.name));
}