Skip to content

fix(opencode): add trailing newline to CLI help output#29898

Open
fcharras wants to merge 2 commits into
anomalyco:devfrom
fcharras:fix/cli-help-trailing-newline
Open

fix(opencode): add trailing newline to CLI help output#29898
fcharras wants to merge 2 commits into
anomalyco:devfrom
fcharras:fix/cli-help-trailing-newline

Conversation

@fcharras
Copy link
Copy Markdown

Issue for this PR

Closes #28606 #26114 #24804 #22115

Type of change

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

What does this PR do?

The CLI help output (opencode --help and opencode <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() in packages/opencode/src/index.ts, both write paths now trimEnd() the help text and append a single EOL. 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

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

@github-actions
Copy link
Copy Markdown
Contributor

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:

  1. PR fix: add trailing newline to help output #26374 - fix: add trailing newline to help output
    fix: add trailing newline to help output #26374

  2. PR fix(cli): add newline to help output #28622 - fix(cli): add newline to help output
    fix(cli): add newline to help output #28622

  3. PR fix(opencode): ensure help output ends with newline #28643 - fix(opencode): ensure help output ends with newline
    fix(opencode): ensure help output ends with newline #28643

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.

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.

CLI --help lacks trailing newline

1 participant