Initial commit
This commit is contained in:
34
src/Commands/StatusCommand.php
Normal file
34
src/Commands/StatusCommand.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user