GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — feat: add JSON output to coder ai-gateway keys create by nickvigilante · Pull Request #30139 · coder/coder Conversation
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
fef65c0 to
c2d0597
Compare
c2d0597 to
06f20e8
Compare
…pers (#30508) Adds two small helpers to `cli/cliui/output.go` so commands that add `-o/--output` don't repeat the same boilerplate, as suggested in #30152 (comment) by @jeremyruppel. - `TextFormatFunc[T]` wraps `ChangeFormatterData(TextFormat(), ...)` with the type assertion and "expected X, got Y" error, so a command only supplies its render function. - `(*OutputFormatter).WriteLine` formats data and writes it to an `io.Writer` with a trailing newline, replacing the `Format` + `Fprintln` block. No existing callers change in this PR. These PRs are stacked on it and use the helpers: - #30135 `coder tokens create` - #30139 `coder ai-gateway keys create` - #30145 `coder organizations members edit-roles` - #30152 `coder provisioner keys create` Migrating the existing callers on `main` (for example `cli/organization.go`, `enterprise/cli/workspaceproxy.go`) is left for a follow-up, since some of them print with `Fprint` rather than `Fprintln` and need care to keep output identical. Refs CLI-56 <details> <summary>Decision log</summary> - A global `-o` flag on the root command was ruled out because `coder config-ssh` already uses `-o` for `--ssh-option`. - The "one-time secret plus metadata" response structs in #30135 and #30152 stay local to each command, since they embed different SDK types and a shared helper would save little. - `WriteLine` uses `Fprintln` to match the four stacked PRs and most existing callers. It was renamed from `Write` during review so the trailing newline is visible at call sites and the method is not confused with `io.Writer`. </details> > [!NOTE] > This PR was generated by Coder Agents on behalf of @nickvigilante.
`coder ai-gateway keys create` printed the new key's secret as prose, while `keys list` supports `-o json`. Linear: CLI-18
06f20e8 to
21698c3
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.