Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ linters:
linters:
- forbidigo
text: user agent of the front end
# A test's child process stands in for a program whose stdout is its output.
- path: _test\.go
linters:
- forbidigo
text: stdout is a command's output
- path: internal/tfstate/apiproxy/
linters:
- forbidigo
Expand Down Expand Up @@ -142,6 +147,14 @@ linters:
- pattern: ^time\.Sleep$
pkg: ^time$
msg: a test waits on synctest's fake clock; run it inside synctest.Test and call synctest.Sleep
# stdout carries only what a command outputs, so that a pipe reads nothing else. Taking it
# from the command lets a test capture it.
- pattern: ^fmt\.Print(f|ln)?$
pkg: ^fmt$
msg: &stdout-only stdout is a command's output; write that to cmd.OutOrStdout(), and anything for a person through slog or cmd.ErrOrStderr()
- pattern: ^os\.Stdout$
pkg: ^os$
msg: *stdout-only

gocritic:
disabled-checks:
Expand Down
3 changes: 2 additions & 1 deletion cmd/internal/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ func (f *OutputFlag) Type() string {
}

// WriteList leaves a listing that fails part way through unterminated, so that json output which
// stopped early does not parse as a complete array.
// stopped early does not parse as a complete array. ndjson has no end to leave out, so there only
// the exit status tells a cut listing from a complete one.
func (format OutputFormat) WriteList(w io.Writer, items iter.Seq2[jsontext.Value, error]) error {
list, err := format.listing()
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions skills/meshstack-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ workspace identifier as meshPanel shows it (`metadata.name`, for example
Commands for people (`auth status`, `profile list`) write Markdown. The others write one JSON array
by default. For anything you consume yourself, use `-o ndjson`: one JSON object per line, so `jq`
filters stream. A listing stops at 100 items unless you pass `--limit <n>` or `--limit unlimited`.
A listing that fails part way leaves the lines it got and exits non-zero, which a pipe hides: run
with `set -o pipefail`.

```sh
meshstack bb list --limit unlimited -o ndjson | jq -r '...'
Expand Down
Loading