Add module:validate command to daenerys tool.

This commit is contained in:
Austen McDonald
2016-05-30 20:03:29 -07:00
parent aca3505aa1
commit a73f4036a3
2 changed files with 21 additions and 10 deletions
@@ -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;
}
}
}
+6 -2
View File
@@ -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();
}
}