-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: add \x command to toggle records display format #56829
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
psql
has a\x
command to toggle extended output for results. CRDBalready supports this output format via
\set display_format=records
.This commit adds
\x [on|off]
to toggle betweenrecords
andtable
display formats.
The
auto
option frompsql
to automatically enable extended outputdepending on the result width is not supported, only
on
andoff
.Resolves #56706.
Release note (cli change): A
\x [on|off]
command has been added totoggle the
records
display format, followingpsql
behavior.Also adds support for
yes
andno
as boolean options for slash commands as a separate commit, followingpsql
.