forked from a64f7bb4-7358-4778-9fbe-3b882c34cc1d/v1
30 lines
1.1 KiB
PHP
30 lines
1.1 KiB
PHP
#!/usr/bin/env php
|
|
<?php
|
|
|
|
use DrupalCodeGenerator\Application;
|
|
use DrupalCodeGenerator\BootstrapHandler;
|
|
use DrupalCodeGenerator\ClassResolver\SimpleClassResolver;
|
|
use DrupalCodeGenerator\Command\GenerateCompletion;
|
|
use DrupalCodeGenerator\Command\Navigation;
|
|
use DrupalCodeGenerator\GeneratorFactory;
|
|
use Psr\Log\NullLogger;
|
|
|
|
// The autoloader may have a different location if DCG is installed as a local
|
|
// Composer package.
|
|
$class_loader = file_exists(__DIR__ . '/../vendor/autoload.php')
|
|
? require __DIR__ . '/../vendor/autoload.php'
|
|
: require __DIR__ . '/../../../autoload.php';
|
|
|
|
$bootstrap_handler = new BootstrapHandler($class_loader);
|
|
$container = $bootstrap_handler->bootstrap();
|
|
|
|
$generator_factory = new GeneratorFactory(new SimpleClassResolver(), new NullLogger());
|
|
$generators = $generator_factory->getGenerators([Application::ROOT . '/src/Command'], Application::GENERATOR_NAMESPACE);
|
|
|
|
$application = Application::create($container);
|
|
$application->addCommands($generators);
|
|
$application->add(new GenerateCompletion());
|
|
$application->add(new Navigation());
|
|
$application->setDefaultCommand('navigation');
|
|
$application->run();
|