-
Notifications
You must be signed in to change notification settings - Fork 905
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
Chocolatey command help output written to standard error instead of standard out #468
Comments
Hi, You may want to use the real more or install the less commands to get what you desire. On Friday, October 16, 2015, Josh Buedel [email protected] wrote:
Rob http://devlicio.us/blogs/rob_reynolds |
I'm pretty sure powershell's more works with standard output. Anyway, regardless of what is right, chocolatey is inconsistent in the way it outputs subcommand help versus just |
It doesn't do anything different from a technical perspective. |
Are you not seeing the behavior I described? |
I don't see paged output for either. |
Hmm. I've confirmed it on two separate machines now. I suppose it is possible that my powershell is tweaked similarly on both machines, yet different than yours. I'll see if I can duplicate on other machines. |
I've figured out what is going on. The short explanation is: the option descriptions text that follows "Option and Switches" part of the help text is written to StdErr. The rest of the output goes through the logging system and ultimately comes out of StdOut. The longer explanation is that the inconsistency I saw with paging was that the 'choco -h' command had enough StdOut text that it would page. 'choco list -h' has very little StdOut output and did not need to page. The tricky bit was that the StdErr output, in both cases, is going directly to the screen. It actually appears above the StdOut text in my console. There is enough option description text that it scrolls, giving the appearance that more is not paging. I guess StdErr beats StdOut to the console, probably because StdOut is passing through more.com first, slowing it down. If you agree that all the help text should be consistently written to StdOut, I suggest that the fix would occur in ConfigurationOptions.show_help(). One solution is to replace Console.Error with Console.Out as the parameter to OptionSet.WriteOptionDescriptions(). Another is to capture the text OptionSet.WriteOptionDecriptions() writes to an in memory stream and then push that text through the logging system. This would be more consistent with how the rest of the help text is written. If you agree with either of my proposed solutions I'd like to submit a pull request. Just let me know how you'd like it handled. |
Ah, sweet. Yeah, the options should not be written to stderr. I have a feeling that is either something I was doing or something embedded into NDesk.Options that needs fixed. |
@jbuedel Yes you may implement a fix. :) |
Target stable for quickest results. |
@jbuedel ping - I'm looking for this coming up soon. If you still want to provide a fix let me know, otherwise I will assume you got busy and will handle this. 👍 |
Hi Rob. Yeah unfortunately I've just been too busy to dig into it. I haven't forgotten though. I'll see what I can do over the next few days, but if you beat me to it, no problem.
|
I am signing up to help with this as I was "bitten" by this problem today. |
@secretGeek target stable if you can - otherwise I will rebase onto stable when merging. 👍 |
Commands such as: choco list -help | more choco list -help | out-host -paging ...did not page as expected. Similarly: choco -help | out-file HelpDetails.txt did not deliver all of the help output to the file. (The workaround of using 2>&1 (or *>&1) is burdensome for the very people who need help in the first place.) So, in line with normal use of NDesk OptionSet, the option descriptions are now written to Console.Out not Console.Error.
This is my first public PR. Any problems I'll do my best to resolve ;) |
Thanks for your contribution! 👍 |
Previously, help information was written out to stderr due to how NDesk OptionSet provides the help output. This causes commands such as the following to not page as expected: * `choco list -help | more` * `choco list -help | out-host -paging` Similarly `choco -help | out-file HelpDetails.txt` does not deliver all of the help output to the file. While there is a workaround of using `2>&1` (or `*>&1`) is burdensome for the very people who need help in the first place. Help information should instead be provided in stdout and not in stderr. This allows us to avoid these issues entirely.
* stable: (GH-468) Log help to standard out, not standard error
If I issue
choco -h | more
I get paged output, as expected.choco source -h | more
never pages. That is, all output is dumped to the console immediately.This happens with all the subcommands I tried, including 'search', 'list', and 'source'.
The text was updated successfully, but these errors were encountered: