fix: show full option descriptions in --help output#9233
Closed
lovasoa wants to merge 1 commit intonpm:latestfrom
Closed
fix: show full option descriptions in --help output#9233lovasoa wants to merge 1 commit intonpm:latestfrom
lovasoa wants to merge 1 commit intonpm:latestfrom
Conversation
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.
Contributor
|
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. |
Author
|
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 ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.