Improvements and fixes
* Updated README, added LICENSE * New services: memcached, phpcacheadmin * Polished commands * ContainerManager now persists state
This commit is contained in:
@ -5,6 +5,7 @@ namespace NoccyLabs\Serverctl\Commands;
|
||||
use NoccyLabs\Spinner\Spinner;
|
||||
use NoccyLabs\Spinner\Style\BrailleDotsStyle;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@ -19,7 +20,7 @@ class StatusCommand extends Command
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
||||
/*
|
||||
$spinner = new Spinner(style: BrailleDotsStyle::class, fps: 15);
|
||||
|
||||
$output->write(" Getting status\r");
|
||||
@ -27,7 +28,26 @@ class StatusCommand extends Command
|
||||
if ($output->isDecorated()) $output->write("({$spinner})\r");
|
||||
usleep(10000);
|
||||
}
|
||||
*/
|
||||
|
||||
$containerManager = $this->getContainerManager();
|
||||
|
||||
$table = new Table($output);
|
||||
$table->setStyle('compact');
|
||||
$table->setHeaders([ "Service", "Instance", "Purpose", "Port" ]);
|
||||
|
||||
$running = $containerManager->getRunningServices();
|
||||
$s = 0;
|
||||
foreach ($running as $service) {
|
||||
$s++;
|
||||
$i = 0;
|
||||
foreach ($service['ports'] as $portInfo=>$portNumber) {
|
||||
$table->addRow([ ($i==0)?$service['service']['name']:"", ($i==0)?$service['instance']:"", $portInfo, $portNumber ]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$table->render();
|
||||
$output->writeln("<options=bold>{$s}</> running services.");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user