From 1954361cf72d961410a896bdb081d10e5c1e2da5 Mon Sep 17 00:00:00 2001 From: tracer Date: Tue, 18 Jan 2022 19:27:08 +0100 Subject: [PATCH] changet table layout --- bindAPI/bin/console | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bindAPI/bin/console b/bindAPI/bin/console index e14b3a6..d780db5 100755 --- a/bindAPI/bin/console +++ b/bindAPI/bin/console @@ -30,10 +30,6 @@ if ($argc < 2) { exit(0); } -//print(__DIR__ . PHP_EOL); -//print(dirname(__DIR__) . PHP_EOL); - -//exit; require dirname(__DIR__) . '/vendor/autoload.php'; $dbConnection = (new DatabaseConnection())->getConnection(); @@ -53,13 +49,17 @@ switch($command) { echo "\033[32m\t" . $result['tokenPrefix'] . '.' . $result['key'] . PHP_EOL; exit(0); case "list": - echo 'All available API keys:' . PHP_EOL; - echo " No\tAPI key prefix" . PHP_EOL; + echo 'All valid API keys:' . PHP_EOL; $keys = $apiUsers->findAll(); if ($keys) { + $table = new \LucidFrame\Console\ConsoleTable(); + $table->setHeaders(['ID', 'API key prefix']); foreach ($keys as $key) { - echo $key['id'] . "\t". $key['api_token_prefix'] . PHP_EOL; + $table->addRow([$key['id'], $key['api_token_prefix']]); } + $table->setPadding(2); + $table->display(); + } else { echo 'No keys found.' . PHP_EOL; }