fix(opencode): add trailing newline to CLI help output#29898
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Found potential duplicates! There are several related PRs addressing the same help output newline issue:
These PRs all address the same issue of adding a trailing newline to CLI help output. The current PR (#29898) appears to be another attempt to fix the same problem, likely because the previous PRs may have been closed or incomplete. You may want to check the status of these older PRs and consolidate efforts if they're still open. |
Issue for this PR
Closes #28606 #26114 #24804 #22115
Type of change
What does this PR do?
The CLI help output (
opencode --helpandopencode <command> --help) is written to stderr without a trailing newline. This meant the shell prompt appears directly appended to the last line of the help text, and any tooling consuming the output have no terminating newline.In
show()inpackages/opencode/src/index.ts, both write paths nowtrimEnd()the help text and append a singleEOL. This guarantees exactly one trailing newline regardless of whether yargs already produced trailing whitespace, in both the logo branch and the default branch.I updated the help-text snapshots to reflect the new trailing newline.
How did you verify your code works?
Ran the CLI help commands locally and confirmed the output ends with a single newline. Re-ran the help snapshot test suite, which now passes with the regenerated snapshots.
Screenshots / recordings
N/A — CLI text output change, covered by snapshot tests.
Checklist