Skip to content

fix(cli): add trailing newline to --help output#22125

Open
MuoDoo wants to merge 1 commit intoanomalyco:devfrom
MuoDoo:fix/help-trailing-newline
Open

fix(cli): add trailing newline to --help output#22125
MuoDoo wants to merge 1 commit intoanomalyco:devfrom
MuoDoo:fix/help-trailing-newline

Conversation

@MuoDoo
Copy link
Copy Markdown

@MuoDoo MuoDoo commented Apr 12, 2026

Issue for this PR

Closes #22115

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Running opencode --help outputs help text without a trailing newline, causing the shell prompt to appear on the same line as the last line of output.

The show() function in packages/opencode/src/index.ts writes to stderr via process.stderr.write(), but yargs help output doesn't include a trailing newline. Both code paths (with and without the logo) now check for and append EOL when missing.

How did you verify your code works?

Ran opencode --help 2>&1 | xxd | tail -5 before and after the fix:

  • Before: output ends with [string] (hex 5d), no 0a newline
  • After: output ends with 0a (newline)

Screenshots / recordings

N/A — CLI output change, not UI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shell missing a new line with --help

1 participant