register method

void register(
  1. Command command, {
  2. CommandCategory category = CommandCategory.system,
  3. List<String> extraAliases = const [],
  4. bool hidden = false,
  5. bool requiresAuth = false,
  6. bool requiresGit = false,
})

Register a command with metadata.

Implementation

void register(
  Command command, {
  CommandCategory category = CommandCategory.system,
  List<String> extraAliases = const [],
  bool hidden = false,
  bool requiresAuth = false,
  bool requiresGit = false,
}) {
  final reg = CommandRegistration(
    command: command,
    category: category,
    extraAliases: extraAliases,
    hidden: hidden,
    requiresAuth: requiresAuth,
    requiresGit: requiresGit,
  );
  _commands.add(reg);
  _byName[command.name] = reg;
  for (final alias in reg.allAliases) {
    _byAlias[alias] = reg;
  }
}