| @@ 13-34 (lines=22) @@ | ||
| 10 | use Symfony\Component\Console\Input\InputInterface; |
|
| 11 | use Symfony\Component\Console\Output\OutputInterface; |
|
| 12 | ||
| 13 | class MakeIntent extends Command |
|
| 14 | { |
|
| 15 | protected function configure(): void |
|
| 16 | { |
|
| 17 | $this |
|
| 18 | ->setName('make:intent') |
|
| 19 | ->setDescription('Create a new intent class') |
|
| 20 | ->addArgument('name', InputArgument::REQUIRED, 'Name of intent'); |
|
| 21 | } |
|
| 22 | ||
| 23 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 24 | { |
|
| 25 | $name = $input->getArgument('name'); |
|
| 26 | ||
| 27 | /** @var ConversationCreator $creator */ |
|
| 28 | $creator = $this->kernel->resolve(ConversationCreator::class); |
|
| 29 | ||
| 30 | $creator->createIntent('src', 'App', $name); |
|
| 31 | ||
| 32 | $output->writeln('<comment>Intent created.</comment>'); |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||
| @@ 13-34 (lines=22) @@ | ||
| 10 | use Symfony\Component\Console\Input\InputInterface; |
|
| 11 | use Symfony\Component\Console\Output\OutputInterface; |
|
| 12 | ||
| 13 | class MakeInteraction extends Command |
|
| 14 | { |
|
| 15 | protected function configure(): void |
|
| 16 | { |
|
| 17 | $this |
|
| 18 | ->setName('make:interaction') |
|
| 19 | ->setDescription('Create a new interaction class') |
|
| 20 | ->addArgument('name', InputArgument::REQUIRED, 'Name of intent'); |
|
| 21 | } |
|
| 22 | ||
| 23 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 24 | { |
|
| 25 | $name = $input->getArgument('name'); |
|
| 26 | ||
| 27 | /** @var ConversationCreator $creator */ |
|
| 28 | $creator = $this->kernel->resolve(ConversationCreator::class); |
|
| 29 | ||
| 30 | $creator->createInteraction('src', 'App', $name); |
|
| 31 | ||
| 32 | $output->writeln('<comment>Interaction created.</comment>'); |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||