Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 821e91d

Browse files
committed
Make as-tree option define the inline level where to switch to inline YAML
1 parent 494cfbd commit 821e91d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function configure()
8484
new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to update'),
8585
new InputOption('xliff-version', null, InputOption::VALUE_OPTIONAL, 'Override the default xliff version', '1.2'),
8686
new InputOption('sort', null, InputOption::VALUE_OPTIONAL, 'Return list of messages sorted alphabetically', 'asc'),
87-
new InputOption('as-tree', null, InputOption::VALUE_NONE, 'Dump the messages as a tree-like structure'),
87+
new InputOption('as-tree', null, InputOption::VALUE_OPTIONAL, 'Dump the messages as a tree-like structure: The given value defines the level where to switch to inline YAML'),
8888
])
8989
->setDescription('Updates the translation file')
9090
->setHelp(<<<'EOF'
@@ -109,6 +109,12 @@ protected function configure()
109109
110110
<info>php %command.full_name% --dump-messages --sort=asc en AcmeBundle</info>
111111
<info>php %command.full_name% --dump-messages --sort=desc fr</info>
112+
113+
You can dump a tree-like structure using the yaml format with <comment>--as-tree</> flag:
114+
115+
<info>php %command.full_name% --force --output-format=yaml --as-tree=3 en AcmeBundle</info>
116+
<info>php %command.full_name% --force --output-format=yaml --sort=asc --as-tree=3 fr</info>
117+
112118
EOF
113119
)
114120
;
@@ -303,7 +309,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
303309
$bundleTransPath = end($transPaths);
304310
}
305311

306-
$this->writer->write($operation->getResult(), $input->getOption('output-format'), ['path' => $bundleTransPath, 'default_locale' => $this->defaultLocale, 'xliff_version' => $input->getOption('xliff-version'), 'as_tree' => $input->getOption('as-tree')]);
312+
$this->writer->write($operation->getResult(), $input->getOption('output-format'), ['path' => $bundleTransPath, 'default_locale' => $this->defaultLocale, 'xliff_version' => $input->getOption('xliff-version'), 'as_tree' => $input->getOption('as-tree'), 'inline' => $input->getOption('as-tree') ?? 0]);
307313

308314
if (true === $input->getOption('dump-messages')) {
309315
$resultMessage .= ' and translation files were updated';

0 commit comments

Comments
 (0)