changet table layout
This commit is contained in:
parent
9b4b0fb081
commit
1954361cf7
|
@ -30,10 +30,6 @@ if ($argc < 2) {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//print(__DIR__ . PHP_EOL);
|
|
||||||
//print(dirname(__DIR__) . PHP_EOL);
|
|
||||||
|
|
||||||
//exit;
|
|
||||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||||
|
|
||||||
$dbConnection = (new DatabaseConnection())->getConnection();
|
$dbConnection = (new DatabaseConnection())->getConnection();
|
||||||
|
@ -53,13 +49,17 @@ switch($command) {
|
||||||
echo "\033[32m\t" . $result['tokenPrefix'] . '.' . $result['key'] . PHP_EOL;
|
echo "\033[32m\t" . $result['tokenPrefix'] . '.' . $result['key'] . PHP_EOL;
|
||||||
exit(0);
|
exit(0);
|
||||||
case "list":
|
case "list":
|
||||||
echo 'All available API keys:' . PHP_EOL;
|
echo 'All valid API keys:' . PHP_EOL;
|
||||||
echo " No\tAPI key prefix" . PHP_EOL;
|
|
||||||
$keys = $apiUsers->findAll();
|
$keys = $apiUsers->findAll();
|
||||||
if ($keys) {
|
if ($keys) {
|
||||||
|
$table = new \LucidFrame\Console\ConsoleTable();
|
||||||
|
$table->setHeaders(['ID', 'API key prefix']);
|
||||||
foreach ($keys as $key) {
|
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 {
|
} else {
|
||||||
echo 'No keys found.' . PHP_EOL;
|
echo 'No keys found.' . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue