fix: show full option descriptions in --help output - #9233
Conversation
|
Okay, I think this was actually an intentional design decision. Some of those descriptions are very long and --help is meant to give you a quick summary - i don't think we want full descriptions in there anyway. |
|
Sentences are cut in the middle without any explanation. Maybe the output should at least let the use know why and how to get the full description ? |
|
@lovasoa in speaking to the engineer that made the change, I found out it was not intentional 😆 . My apologies. If you want to get this up to date I can review/merge. If not I'll get to the change when I can |
|
Could this PR be revived? I believe that @owlstronaut has however left the organization though, so it would probably need a different sponsor. |
The help text for command options was truncated to the first line of each
multi-line description. For example, `npm version --help` showed:
--allow-same-version
Prevents throwing an error when `npm version` is used to set the new
Instead of the full description. This affected all commands.
The cause was `.split('\n')[0]` in base-cmd.js getUsage(), which discarded
everything after the first newline. Fix by joining all lines into a single
string.
4f9cb89 to
8cb0b1b
Compare
Option descriptions in
--helpoutput were truncated to the first line. For example,npm version --helpshowed:instead of the complete text:
This affected all commands, not just
version.Cause:
getUsage()inlib/base-cmd.jsused.split(n)[0]on each description, discarding everything after the first newline. Since descriptions are multi-line template literals, this cut most of them off mid-sentence.Fix: Join all lines of the description into a single string instead of taking only the first line.