fix(opencode): output error message before help in .fail() handler#31488
Open
Btocode wants to merge 1 commit into
Open
fix(opencode): output error message before help in .fail() handler#31488Btocode wants to merge 1 commit into
Btocode wants to merge 1 commit into
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate PRs FoundI found two related PRs that appear to address the same issue:
Both PRs appear to be fixing the same issue: ensuring error messages are displayed to the user before or instead of the help text when invalid arguments are passed. PR #31228 seems to be the most recent attempt at this fix with very similar wording to the current PR #31488. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #29390
Type of change
What does this PR do?
When passing an invalid argument like
--unknown-flag, the.fail()handler in yargs was callingcli.showHelp(show)but never output the error messagemsgto stderr. This meant the user saw the same output as--helpwith no indication of what they did wrong.The fix writes the error message to stderr before showing the help text, so the user sees e.g. "Unknown argument: --unknown-flag" followed by the help output.
How did you verify your code works?
msgcontains the error string andEOLis already importedprocess.stderr.write(...))Screenshots / recordings
N/A — CLI change only.
Checklist