5 * Contains \Drupal\Console\Command\Develop\GenerateDocDataCommand.
8 namespace Drupal\Console\Command\Develop;
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
12 use Symfony\Component\Console\Input\InputOption;
13 use Symfony\Component\Console\Command\Command;
14 use Drupal\Console\Core\Style\DrupalStyle;
15 use Drupal\Console\Core\Command\Shared\CommandTrait;
17 class GenerateDocDataCommand extends Command
25 protected function configure()
28 ->setName('generate:doc:data')
30 $this->trans('commands.generate.doc.data.description')
35 InputOption::VALUE_OPTIONAL,
36 $this->trans('commands.generate.doc.data.options.file')
44 protected function execute(InputInterface $input, OutputInterface $output)
46 $io = new DrupalStyle($input, $output);
48 if ($input->hasOption('file')) {
49 $file = $input->getOption('file');
52 $data = $this->getApplication()->getData();
54 file_put_contents($file, json_encode($data, JSON_PRETTY_PRINT));
59 $io->write(json_encode($data, JSON_PRETTY_PRINT));