changet table layout

This commit is contained in:
tracer 2022-01-18 19:27:08 +01:00
parent 9b4b0fb081
commit 1954361cf7
1 changed files with 7 additions and 7 deletions

View File

@ -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;
}