-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Ease writing to stderr using SymfonyStyle #20586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Console] Ease writing to stderr using SymfonyStyle #20586
Conversation
chalasr
commented
Nov 21, 2016
•
edited
Loading
edited
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #15986 |
License | MIT |
Doc PR | n/a |
3aebb3a
to
e8f2aa4
Compare
Can't be in 2.8, should be in master |
e8f2aa4
to
dadbebe
Compare
a57543c
to
2848adc
Compare
Changed the scope then, proposing |
@chalasr you decide :) |
Even adding a new method must be in master, as it is a new feature |
return; | ||
$this->listBundles($errorIo); | ||
$errorIo->comment('Provide the name of a bundle as the first argument of this command to dump its configuration. (e.g. <comment>debug:config FrameworkBundle</comment>)'); | ||
$errorIo->comment('For dumping a specific option, add its path as the second argument of this command. (e.g. <comment>debug:config FrameworkBundle serializer</comment> to dump the <comment>framework.serializer</comment> configuration)'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing the return is broken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 fixed in #20632
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please dismiss your review? As the change is no more in this PR
2848adc
to
b2d7a1a
Compare
|
||
public function testGetErrorIo() | ||
{ | ||
$input = $this->getMock('Symfony\Component\Console\Input\InputInterface'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use the InputInterface::class
notation now that this PR targets master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, fixed
b2d7a1a
to
293e627
Compare
* | ||
* @return self | ||
*/ | ||
public function getErrorIo() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method name looks weird to me as we don't use IO anywhere in the code IIRC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. getErrorStyle()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to getErrorStyle()
1adbc3e
to
ed656e2
Compare
protected function getErrorOutput() | ||
{ | ||
if (!$this->output instanceof ConsoleOutputInterface) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it throw instead?
3a02b96
to
43b7085
Compare
protected function getErrorOutput() | ||
{ | ||
if (!$this->output instanceof ConsoleOutputInterface) { | ||
throw new LogicException(sprintf('The output must be an instance of %s for using getErrorOutput().', ConsoleOutputInterface::class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about returning the regular output instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, updated
552c419
to
207836f
Compare
207836f
to
5b0504c
Compare
Thank you @chalasr. |
…halasr) This PR was merged into the 3.3-dev branch. Discussion ---------- [Console] Ease writing to stderr using SymfonyStyle | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #15986 | License | MIT | Doc PR | n/a Commits ------- 5b0504c [Console] Ease writing to stderr using styles
…output (chalasr, ogizanagi) This PR was merged into the 3.3-dev branch. Discussion ---------- [FrameworkBundle] Make use of stderr for non reliable output | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Built-in commands should make use of the proper outputs. As a feature on master, considering that people may actually rely on stdout and the fact commands have been changed a lot since 2.7, I think it's not worth doing this change on lower branches. Please see also #20586 which adds a `SymfonyStyle::getErrorStyle()` shortcut for easily switching to stderr. Commits ------- 7b262d8 [FrameworkBundle] Use getErrorStyle() when relevant 9a3a568 Use stderr for some other commands 1ee48bf [FrameworkBundle] Make use of stderr for non reliable output
…ing SymfonyStyle (chalasr, javiereguiluz) This PR was merged into the master branch. Discussion ---------- [Console] Document how to exclude messages from output using SymfonyStyle This adds documentation for symfony/symfony#20586, any suggestion will be really welcomed. Commits ------- a5c5524 Minor fix ff0ccde Reworded the description 31a2a44 Document how to exclude irrelevant messages from command output using SymfonyStyle