cli: add \x command to toggle records display format#56829
cli: add \x command to toggle records display format#56829craig[bot] merged 2 commits intocockroachdb:masterfrom
Conversation
|
Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR. My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
knz
left a comment
There was a problem hiding this comment.
Hi Eric, glad to see your contribution!
Reviewed 2 of 2 files at r1.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @erikgrinaker)
pkg/cli/sql.go, line 318 at r1 (raw file):
val = strings.ToLower(strings.TrimSpace(val)) switch val { case "false", "0", "off":
then reuse it here
pkg/cli/sql.go, line 489 at r1 (raw file):
err = opt.set(val) } else { switch val {
Can you extract this boolean parsing code into a reusable function
pkg/cli/sql.go, line 1181 at r1 (raw file):
case 2: switch strings.TrimSpace(strings.ToLower(cmd[1])) { case "on", "1", "true":
and also here
thanks
a71af52 to
0793229
Compare
|
Thank you for updating your pull request. Before a member of our team reviews your PR, I have some potential action items for you:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
|
Sure @knz, done! Also added support for |
d4b2008 to
1cd5b84
Compare
This commit adds a utility function `parseBool` for parsing boolean strings in SQL shell slash commands, and uses it instead of ad-hoc parsing in individual commands. It also adds support for `yes` and `no` as valid boolean values, following `psql` behavior. Release note (cli change): The SQL shell now accepts `yes`/`no` as boolean options for slash commands, following `psql` behavior.
`psql` has a `\x` command to toggle extended output for results. CRDB already supports this output format via `\set display_format=records`. This commit adds `\x [on|off]` to toggle between `records` and `table` display formats. The `auto` option from `psql` to automatically enable extended output depending on the result width is not supported, only `on` and `off`. Resolves cockroachdb#56706. Release note (cli change): A `\x [on|off]` command has been added to toggle the `records` display format, following `psql` behavior.
1cd5b84 to
07ecb7f
Compare
knz
left a comment
There was a problem hiding this comment.
Reviewed 3 of 4 files at r2, 2 of 2 files at r3.
Reviewable status:complete! 1 of 0 LGTMs obtained
|
Could you ask bors to merge this please? |
|
bors r+ |
|
Build succeeded: |
psqlhas a\xcommand to toggle extended output for results. CRDBalready supports this output format via
\set display_format=records.This commit adds
\x [on|off]to toggle betweenrecordsandtabledisplay formats.
The
autooption frompsqlto automatically enable extended outputdepending on the result width is not supported, only
onandoff.Resolves #56706.
Release note (cli change): A
\x [on|off]command has been added totoggle the
recordsdisplay format, followingpsqlbehavior.Also adds support for
yesandnoas boolean options for slash commands as a separate commit, followingpsql.