use method

void use(
  1. String name,
  2. Command command, {
  3. bool isDefault = false,
})

Appends a command to the list of commands.

final commands = Commands();
commands.use('foo', fooCommand);
commands.use('bar', barCommand, isDefault: true);

Implementation

void use(String name, Command command, {bool isDefault = false}) {
  commands[name] = command;
  if (isDefault) {
    defaultCommand = command;
  }
}