9 use Symfony\Component\Console\Command\Command;
10 use Symfony\Component\Console\Input\InputArgument;
11 use Symfony\Component\Console\Input\InputOption;
12 use Symfony\Component\Console\Input\InputInterface;
13 use Symfony\Component\Console\Output\OutputInterface;
35 $this->setName(
'i18n:collect-phrases')
36 ->setDescription(
'Discovers phrases in the codebase');
37 $this->setDefinition([
39 self::INPUT_KEY_DIRECTORY,
40 InputArgument::OPTIONAL,
41 'Directory path to parse. Not needed if --magento flag is set' 44 self::INPUT_KEY_OUTPUT,
45 self::SHORTCUT_KEY_OUTPUT,
46 InputOption::VALUE_REQUIRED,
47 'Path (including filename) to an output file. With no file specified, defaults to stdout.' 50 self::INPUT_KEY_MAGENTO,
51 self::SHORTCUT_KEY_MAGENTO,
52 InputOption::VALUE_NONE,
53 'Use the --magento parameter to parse the current Magento codebase.' .
54 ' Omit the parameter if a directory is specified.' 64 $directory = $input->getArgument(self::INPUT_KEY_DIRECTORY);
65 if ($input->getOption(self::INPUT_KEY_MAGENTO)) {
67 if ($input->getArgument(self::INPUT_KEY_DIRECTORY)) {
68 throw new \InvalidArgumentException(
'Directory path is not needed when --magento flag is set.');
70 }
elseif (!$input->getArgument(self::INPUT_KEY_DIRECTORY)) {
71 throw new \InvalidArgumentException(
'Directory path is needed when --magento flag is not set.');
73 $generator = ServiceLocator::getDictionaryGenerator();
76 $input->getOption(self::INPUT_KEY_OUTPUT),
77 $input->getOption(self::INPUT_KEY_MAGENTO)
79 $output->writeln(
'<info>Dictionary successfully processed.</info>');
80 return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
const SHORTCUT_KEY_MAGENTO
elseif(isset( $params[ 'redirect_parent']))
execute(InputInterface $input, OutputInterface $output)
const INPUT_KEY_DIRECTORY
const SHORTCUT_KEY_OUTPUT