addArgument('name', InputArgument::REQUIRED, 'O nome do template (ex: users/index)')
->addOption('module', 'm', InputOption::VALUE_OPTIONAL, 'O módulo onde o template será criado');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$name = $input->getArgument('name');
$module = $input->getOption('module');
// Garante a extensão .twig
if (!str_ends_with($name, '.twig')) {
$name .= '.twig';
}
if ($module) {
$directory = dirname(__DIR__, 3) . "/modules/{$module}/views";
} else {
$directory = dirname(__DIR__, 3) . "/templates";
}
$filePath = $directory . '/' . $name;
$fileDir = dirname($filePath);
if (file_exists($filePath)) {
$output->writeln("
Novo template criado via CLI.
\n