Commit 03e1b13
authored
Add SQL output format option (#5459)
# Description of Changes
Adds `--format` to `spacetime sql`, matching `spacetime logs` with
`text` as the default and `json` as the raw API response output. The
REPL path passes the selected format through to each query while
preserving the existing text output and stats behavior by default.
Closes #5450.
# API and ABI breaking changes
None.
# Expected complexity level and risk
1. Small CLI-only output option. Default behavior is unchanged.
# Testing
- [x]
`PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH
/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin/rustfmt
--check crates/cli/src/subcommands/sql.rs
crates/cli/src/subcommands/repl.rs`
- [x] `git diff --check`
- [x]
`PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH
/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin/cargo
check -p spacetimedb-cli`
- [x]
`PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH
/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin/cargo
test -p spacetimedb-cli subcommands::sql::tests:: -- --nocapture`
- [x]
`PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH
/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin/cargo
run -p spacetimedb-cli -- sql --help`
- [x]
`PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH
/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin/cargo
ci self-docs --check`
Note: `cargo ci self-docs --check` printed the existing warning
`argument dotnet is missing help text`.
Note: `cargo fmt --all --check` could not be run in this shell because
the installed cargo toolchains do not expose `cargo-fmt`; `rustfmt
--check` was run directly on the touched Rust files instead.
---------
Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>1 parent cbccc96 commit 03e1b13
3 files changed
Lines changed: 50 additions & 6 deletions
File tree
- crates/cli/src/subcommands
- docs/docs/00300-resources/00200-reference/00100-cli-reference
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
36 | 44 | | |
37 | 45 | | |
38 | 46 | | |
| |||
42 | 50 | | |
43 | 51 | | |
44 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
45 | 72 | | |
46 | 73 | | |
47 | 74 | | |
| |||
143 | 170 | | |
144 | 171 | | |
145 | 172 | | |
146 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
147 | 179 | | |
148 | 180 | | |
149 | 181 | | |
| |||
155 | 187 | | |
156 | 188 | | |
157 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
158 | 195 | | |
159 | 196 | | |
160 | 197 | | |
| |||
182 | 219 | | |
183 | 220 | | |
184 | 221 | | |
| 222 | + | |
185 | 223 | | |
186 | 224 | | |
187 | 225 | | |
| |||
201 | 239 | | |
202 | 240 | | |
203 | 241 | | |
204 | | - | |
| 242 | + | |
205 | 243 | | |
206 | 244 | | |
207 | 245 | | |
| |||
243 | 281 | | |
244 | 282 | | |
245 | 283 | | |
246 | | - | |
| 284 | + | |
247 | 285 | | |
248 | 286 | | |
249 | 287 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
295 | 301 | | |
296 | 302 | | |
297 | 303 | | |
| |||
0 commit comments