growthbook / growthbook/cli

TOON and pretty output lack a trailing newline

Open Beginner friendly
#27 0 comments 0 reactions 0 assignees View on GitHub
bug custom
Dominant language
Go
Stars
1
Forks
0
Avg merge
1d 5h
Merged PRs (30d)
18

Description

## Bug

`-o toon` and the default `pretty` output don't end with a trailing newline, so the shell prompt (or the next command's output) glues onto the last line.

## Root cause (Speakeasy)

The generated formatters emit toon via `fmt.Fprint` (no newline), and the generated pretty printer doesn't guarantee a final newline. JSON and YAML already terminate correctly.

## Stopgap fix (retire when upstream is fixed)

Three patches under `.speakeasy/patches/internal/output/`:
- `output.go.patch` — toon (both the `Result` and `--include-headers` paths) uses `fmt.Fprintln(out, strings.TrimRight(toonStr, "\n"))`.
- `pretty.go.patch` — `prettyPrint` buffers, then writes with exactly one trailing newline (idempotent).
- `outputitems.go.patch` — the streaming toon path (`--all`) matches.

**To retire:** once the generated formatters emit a single trailing newline, drop those hunks.

## Refs

- Introduced by #23
- Upstream: file to speakeasy-api/speakeasy (generated output formatters).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the three patches under .speakeasy/patches/internal/output/: output.go.patch, pretty.go.patch, and outputitems.go.patch, covering normal, header, pretty, and streaming paths. Run the CLI with -o toon, default pretty output, and --all to confirm the prompt no longer glues to the output; done means each emits exactly one trailing newline while JSON and YAML remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.