Interfaces

The command system is expressed through two contracts, IConsoleCommandSystem is the surface consumers use to add and remove commands, and IConsoleCommandRegistrator is implemented by types that contribute their own commands to that system. Neither interface extends another. Depending on these interfaces rather than the concrete AplosConsole keeps command registration decoupled from the console implementation.

IConsoleCommandSystem

The contract for a console command system: the surface through which commands are registered and unregistered. Implemented by AplosConsole.

Namespace: AplosConsole.Infrastrcutre

Public methods

RegisterCommand

Parameters:

Example

consoleCommandSystem.RegisterCommand(command);

Description: Registers a command so that it is collected and presented in the console's command display list. See AplosDebugCommand for the command types.


UnregisterCommand

Parameters:

  • id (string) — The CommandId of the command to remove.

Example

consoleCommandSystem.UnregisterCommand("hello");

Description: Removes any previously registered command matching the supplied identifier from the command display list.


IConsoleCommandRegistrator

Contract for a type that supplies its own set of console commands and registers them with a given IConsoleCommandSystem when invoked. Implement this on any object that wants to contribute commands to the console.

Namespace: AplosConsole.Infrastrcutre

Public methods

RegisterCommand

Parameters:

  • consoleCommandSystem (IConsoleCommandSystem) — Command system responsible for handling these commands.

Example

public void RegisterCommand(IConsoleCommandSystem consoleCommandSystem)
{
    consoleCommandSystem.RegisterCommand(myCommand);
}

Description: Registers commands from the implemented object through the command system.