fix: add trailing newline to help output#26374
Open
praveen9354 wants to merge 3 commits into
Open
Conversation
When `opencode auth` is run without a subcommand, yargs' demandCommand fires and the help text is printed via the show() callback. yargs hands the callback help text without a final newline, so the shell prompt ends up glued to the last help line. Ensure show() writes a trailing EOL. Fixes anomalyco#24813
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential duplicate found:
This PR appears to address the same issue (trailing newlines in help output). You may want to check if PR #22125 was already merged or if there's overlap in the implementation. |
Cover the other branch of show(): when help text does not begin with "opencode " we print the logo first, then the text. Mirror the EOL handling so this branch also ends with a newline, matching the non-logo path. Aligns coverage with the broader fix proposed in Signed-off-by: praveen9354 <praveen9354@gmail.com> anomalyco#22125.
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Confirmed the fix is correct - yargs strips trailing whitespace from help output and both branches of the |
This was referenced May 17, 2026
Consolidates the per-branch `endsWith(EOL) ? x : x + EOL` ternaries into a single `content` constant computed at the top of show(). Both the logo-prefixed and bare-help-output paths now use the same prepared string. Functionally equivalent to the previous commit; just clearer and avoids repeating the EOL fix logic in two places. No behavioral change — existing help-output assertion in PR anomalyco#26374 still holds. Also unblocks future formatting helpers that need consistent end-of-output handling without duplicating the check. Signed-off-by: praveen9354 <praveen9354@gmail.com>
This was referenced May 21, 2026
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 #24813
Type of change
What does this PR do?
When
opencode authis run without a subcommand, yargs'demandCommandfires and the help text is printed via theshow()callback inpackages/opencode/src/index.ts. yargs hands the callback help text without a final newline, so the shell prompt ends up glued to the last help line.This patches both branches of
show()to ensure trailing EOL:UI.logo()then the help body)opencodebranch (top-level help)#22125 contains the same fix bundled with a much larger LSP/compaction/i18n change set; this PR is a focused, mergeable extraction so the trailing-newline issue can land independently.
How did you verify your code works?
bun typecheckclean across all 12 workspace packages.bun test --timeout 30000frompackages/opencode/runs cleanly on the affected file (no test exists for theshow()callback specifically; the change is mechanical).devand is resolved on this branch by runningopencode authand observing the prompt now appears on its own line.Screenshots / recordings
N/A — terminal-output behavior; not a UI change.
Checklist