33 lines
998 B
PHP
33 lines
998 B
PHP
<?php
|
|
|
|
namespace NoccyLabs\Serverctl\Commands;
|
|
|
|
use Symfony\Component\Console\Attribute\AsCommand;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
#[AsCommand(name:"find", description:"Find defined services")]
|
|
class FindCommand extends Command
|
|
{
|
|
|
|
protected function configure()
|
|
{
|
|
$this->addArgument("service", InputArgument::OPTIONAL, "Search query");
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
{
|
|
$serviceRegistry = $this->getServiceRegistry();
|
|
|
|
$services = $serviceRegistry->findAllServices();
|
|
|
|
$output->writeln("Available services:");
|
|
foreach ($services as $service) {
|
|
$output->writeln(sprintf(" <comment>%s</> - <info>%s</>", $service['name'], $service['description']??"?"));
|
|
}
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
} |