serverctl/src/Commands/StatusCommand.php

34 lines
889 B
PHP

<?php
namespace NoccyLabs\Serverctl\Commands;
use NoccyLabs\Spinner\Spinner;
use NoccyLabs\Spinner\Style\BrailleDotsStyle;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
#[AsCommand(name:"status", description:"Show the running services")]
class StatusCommand extends Command
{
protected function configure()
{
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$spinner = new Spinner(style: BrailleDotsStyle::class, fps: 15);
$output->write(" Getting status\r");
for ($n = 0; $n < 250; $n++) {
if ($output->isDecorated()) $output->write("({$spinner})\r");
usleep(10000);
}
return self::SUCCESS;
}
}