8000 bug #24455 [Console] Escape command usage (sroze) · symfony/symfony@42a41b3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 42a41b3

Browse files
author
Robin Chalas
committed
bug #24455 [Console] Escape command usage (sroze)
This PR was merged into the 2.7 branch. Discussion ---------- [Console] Escape command usage | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #24225 | License | MIT | Doc PR | ø Escape the console usage to prevent arguments named `info` or similar to be formatted. Commits ------- 2141056 Escape command usage when displaying it in the text descriptor
2 parents dd490af + 2141056 commit 42a41b3

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/Symfony/Component/Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ protected function describeCommand(Command $command, array $options = array())
143143
$this->writeText('<comment>Usage:</comment>', $options);
144144
foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
145145
$this->writeText("\n");
146-
$this->writeText(' '.$usage, $options);
146+
$this->writeText(' '.OutputFormatter::escape($usage), $options);
147147
}
148148
$this->writeText("\n");
149149

src/Symfony/Component/Console/Tests/Fixtures/command_2.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<comment>Usage:</comment>
2-
descriptor:command2 [options] [--] <argument_name>
3-
descriptor:command2 -o|--option_name <argument_name>
4-
descriptor:command2 <argument_name>
2+
descriptor:command2 [options] [--] \<argument_name>
3+
descriptor:command2 -o|--option_name \<argument_name>
4+
descriptor:command2 \<argument_name>
55

66
<comment>Arguments:</comment>
77
<info>argument_name</info>

src/Symfony/Component/Console/Tests/Fixtures/command_mbstring.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<comment>Usage:</comment>
2-
descriptor:åèä [options] [--] <argument_åèä>
3-
descriptor:åèä -o|--option_name <argument_name>
4-
descriptor:åèä <argument_name>
2+
descriptor:åèä [options] [--] \<argument_åèä>
3+
descriptor:åèä -o|--option_name \<argument_name>
4+
descriptor:åèä \<argument_name>
55

66
<comment>Arguments:</comment>
77
<info>argument_åèä</info>

0 commit comments

Comments
 (0)
0