runCommands method

Future<void> runCommands(
  1. List<String> args, [
  2. bool direct = false
])

Processes command-line arguments and enters interactive command mode. Handles the execution of server commands such as:

  • help - Display available commands
  • migrate - Database migration operations
  • language - Language management commands
  • info - Server information display
  • route - Route inspection
  • exit - Graceful server shutdown If no arguments are provided, the method returns immediately. Otherwise, it starts an interactive command prompt (Finch>) where users can continue entering commands. args - List of command-line arguments to process

Implementation

Future<void> runCommands(List<String> args, [bool direct = false]) async {
  if (args.isEmpty) {
    return;
  }

  if (direct) {
    await _getCommandManager(args).process(newArgs: args);
    return;
  }

  return _getCommandManager(args).processWhile(
    initArgs: args,
    appLabel: () => 'Finch> ',
  );
}