-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Display shell help message with out instead of err when missing method
#11179
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
Conversation
|
I discovered the same the last days. |
Codecov Report
@@ Coverage Diff @@
## master #11179 +/- ##
============================================
+ Coverage 93.15% 93.15% +<.01%
- Complexity 12978 12979 +1
============================================
Files 437 437
Lines 33619 33622 +3
============================================
+ Hits 31317 31320 +3
Misses 2302 2302
Continue to review full report at Codecov.
|
|
Or should we show some error message before output help: $this->err('foo');
$this->out($this->OptionParser->help($command)); |
|
Looks like that would make sense. We should at least make sure we keep the exit code of 1 here. |
|
Thanks! |
|
I don't think this change is correct; when usage (help) output is printed due to missing arguments on Linux, that output should be send to stdErr to prevent the output from being piped to other commands when redirecting output. I did a quick search to provide more information, and found this; https://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout, but there should be other resources explaining this |
|
@thaJeztah This change was to restore behaviour that has existed for quite some time. The reasons you cited were part of the reason I has used stderr. But those changes have caused people grief. |
|
@markstory thanks for clarifying - my eye fell on this PR's title, and I know there's sometimes confusion around this, so thought to add the information above, but understand the reason to change if it broke people 👍 |
|
I too disagree with this change. I think a better solution is: diff --git a/src/Console/Shell.php b/src/Console/Shell.php
index d513038..8bd52aa 100644
--- a/src/Console/Shell.php
+++ b/src/Console/Shell.php
@@ -508,7 +508,7 @@ class Shell
return $this->main(...$this->args);
}
- $this->err($this->OptionParser->help($command));
+ $this->_io->err($this->OptionParser->help($command));
return false;
}This also correctly handles the |
|
@rchavik You can make a follow up PR :) |
|
@rchavik 👍 |
When i run
bin/cake orm_cache(without any methods), it shows error message (red font color):