rector/packages/rector-generator/src/Command/InitRecipeCommand.php
Tomas Votruba f672eace0e
[DX] Add init-recipe command to create recipe config in root (#4789)
* [DX] Add init-recipe command to initlaize recipe

* update docs
2020-12-05 13:20:13 +00:00

42 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace Rector\RectorGenerator\Command;
use Rector\RectorGenerator\TemplateInitializer;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symplify\PackageBuilder\Console\ShellCode;
final class InitRecipeCommand extends Command
{
/**
* @var TemplateInitializer
*/
private $templateInitializer;
public function __construct(TemplateInitializer $templateInitializer)
{
parent::__construct();
$this->templateInitializer = $templateInitializer;
}
protected function configure(): void
{
$this->setDescription('[DEV] Initialize "rector-recipe.php" config');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->templateInitializer->initialize(
__DIR__ . '/../../../../templates/rector-recipe.php.dist',
'rector-recipe.php'
);
return ShellCode::SUCCESS;
}
}