private CommandAndHandler findHandlerForCommand(String line) {
    CommandHandler commandHandler = null;
    CliCommand parsedCommand = null;
    for (CommandHandler curCommandHandler : commandHandlers) {
      parsedCommand = curCommandHandler.parseLine(line);
      if (parsedCommand != null && !parsedCommand.getCommandType().getCommandName().equals(CliCommandType.INVALID_COMMAND.getCommandName())) {
        commandHandler = curCommandHandler;
        LOG.info("Found commandHandler {} to handle command {}", commandHandler.getClass().getName(),
            parsedCommand.getFullCommand());
        break;
      }
    }
    return new CommandAndHandler(parsedCommand, commandHandler);
  }
Actually run the shell. Does not return until user choose to exit.
samza-sql-shell/src/main/java/org/apache/samza/sql/client/cli/CliShell.java