function dump_table()

in scripts/extract_redis_commands_argcounts.php [317:339]


function dump_table(array $commands) {
    $header = <<<EOT
    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
    |      Command      | Supported? | Format                                                                                                              |
    +-------------------+------------+---------------------------------------------------------------------------------------------------------------------+
EOT;
    echo $header . "\n";
    $rowLine = explode("\n", $header)[0];
    ksort($commands);
    $parts = explode('+', $rowLine);
    $nameLen = strlen($parts[1]);
    $supportsLen = strlen($parts[2]);
    $commandLen = strlen($parts[3]);
    foreach ($commands as $name => $command) {
        $key = center_pad($name, 19);
        $commandRepr = render_command($name, $command);
        $supports = 'Yes';
        printf("    |%s|%s|%s|\n", center_pad($name, $nameLen), center_pad($supports, $supportsLen), right_pad(' ' . $commandRepr, $commandLen));
        echo $rowLine . "\n";

    }
    echo "\n";
}