Add module:validate command to daenerys tool.
This commit is contained in:
+15
-8
@@ -11,20 +11,27 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ModuleInstallCommand extends Command
|
||||
class ModuleValidateCommand extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('module:install')
|
||||
->setDescription('Install a new LotGD module')
|
||||
->addArgument(
|
||||
'names',
|
||||
InputArgument::IS_ARRAY | InputArgument::REQUIRED,
|
||||
'List of module names to install, vendor/module-name format'
|
||||
);
|
||||
$this->setName('module:validate')
|
||||
->setDescription('Validate installed modules');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$g = Bootstrap::createGame();
|
||||
|
||||
$results = $g->getModuleManager()->validate();
|
||||
|
||||
if (count($results) > 0) {
|
||||
foreach ($results as $r) {
|
||||
$output->writeln($r);
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,18 @@ declare(strict_types=1);
|
||||
|
||||
namespace LotGD\Core\Console;
|
||||
|
||||
use LotGD\Core\Console\Command\ModuleCommand;
|
||||
use LotGD\Core\Console\Command\ModuleValidateCommand;
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
class Main {
|
||||
public static function main()
|
||||
{
|
||||
$application = new Application();
|
||||
$application->add(new ModuleInstallCommand());
|
||||
|
||||
$application->setName("daenerys 🐲 ");
|
||||
$application->setVersion("0.0.1");
|
||||
|
||||
$application->add(new ModuleValidateCommand());
|
||||
$application->run();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user