addArgument('name', InputArgument::REQUIRED, 'O nome da classe do comando (ex: TestCommand)') ->addArgument('command', InputArgument::REQUIRED, 'O comando a ser digitado (ex: app:test)'); } protected function execute(InputInterface $input, OutputInterface $output): int { $name = $input->getArgument('name'); $commandName = $input->getArgument('command'); // Garantir que termina com Command if (!str_ends_with($name, 'Command')) { $name .= 'Command'; } $commandsPath = __DIR__; $filePath = $commandsPath . '/' . $name . '.php'; if (file_exists($filePath)) { $output->writeln("O comando '{$name}' já existe."); return Command::FAILURE; } $template = <<writeln('Executando comando {$commandName}...'); return Command::SUCCESS; } } PHP; if (file_put_contents($filePath, $template)) { $output->writeln("Comando '{$name}' criado com sucesso em app/Console/Commands/"); $output->writeln("Lembre-se de registrar o comando no syscli se necessário."); return Command::SUCCESS; } else { $output->writeln("Falha ao criar o arquivo do comando."); return Command::FAILURE; } } }