Skip to content
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

Implement autowrapping and autoadjusting column width #30

Merged
merged 14 commits into from
Nov 5, 2024

Conversation

apstndb
Copy link
Owner

@apstndb apstndb commented Nov 5, 2024

  • Implement autowrapping and auto adjustment of column width to fit terminal width.
    • Currently, this functionality is only for typed columns
  • Implement --debug and CLI_DEBUG to emit debug log (hidden and undocumented)
> SELECT * FROM INFORMATION_SCHEMA.TABLES LIMIT 10;
+------------+------------+------------+------------+------------+------------+------------+------------+------+
| TABLE_CATA | TABLE_SCHE | TABLE_NAME | PARENT_TAB | ON_DELETE_ | TABLE_TYPE | SPANNER_ST | INTERLEAVE | ROW_ |
| LOG        | MA         | STRING     | LE_NAME    | ACTION     | STRING     | ATE        | _TYPE      | DELE |
| STRING     | STRING     |            | STRING     | STRING     |            | STRING     | STRING     | TION |
|            |            |            |            |            |            |            |            | _POL |
|            |            |            |            |            |            |            |            | ICY_ |
|            |            |            |            |            |            |            |            | EXPR |
|            |            |            |            |            |            |            |            | ESSI |
|            |            |            |            |            |            |            |            | ON   |
|            |            |            |            |            |            |            |            | STRI |
|            |            |            |            |            |            |            |            | NG   |
+------------+------------+------------+------------+------------+------------+------------+------------+------+
|            | INFORMATIO | MODELS     | NULL       | NULL       | VIEW       | NULL       |            | NULL |
|            | N_SCHEMA   |            |            |            |            |            |            |      |
|            | INFORMATIO | SEQUENCE_O | NULL       | NULL       | VIEW       | NULL       |            | NULL |
|            | N_SCHEMA   | PTIONS     |            |            |            |            |            |      |
|            | INFORMATIO | SEQUENCES  | NULL       | NULL       | VIEW       | NULL       |            | NULL |
|            | N_SCHEMA   |            |            |            |            |            |            |      |
|            | INFORMATIO | CHANGE_STR | NULL       | NULL       | VIEW       | NULL       |            | NULL |
|            | N_SCHEMA   | EAM_COLUMN |            |            |            |            |            |      |
|            |            | S          |            |            |            |            |            |      |
|            | INFORMATIO | MODEL_COLU | NULL       | NULL       | VIEW       | NULL       |            | NULL |
|            | N_SCHEMA   | MN_OPTIONS |            |            |            |            |            |      |
|            | INFORMATIO | COLUMN_OPT | NULL       | NULL       | VIEW       | NULL       |            | NULL |
|            | N_SCHEMA   | IONS       |            |            |            |            |            |      |
|            | INFORMATIO | SPANNER_ST | NULL       | NULL       | VIEW       | NULL       |            | NULL |
|            | N_SCHEMA   | ATISTICS   |            |            |            |            |            |      |
|            | INFORMATIO | MODEL_OPTI | NULL       | NULL       | VIEW       | NULL       |            | NULL |
|            | N_SCHEMA   | ONS        |            |            |            |            |            |      |
|            | INFORMATIO | MODEL_COLU | NULL       | NULL       | VIEW       | NULL       |            | NULL |
|            | N_SCHEMA   | MNS        |            |            |            |            |            |      |
|            | INFORMATIO | CHECK_CONS | NULL       | NULL       | VIEW       | NULL       |            | NULL |
|            | N_SCHEMA   | TRAINTS    |            |            |            |            |            |      |
+------------+------------+------------+------------+------------+------------+------------+------------+------+

In wider terminal

> SELECT * FROM INFORMATION_SCHEMA.TABLES LIMIT 10;
+---------------+--------------------+------------+-------------------+------------------+------------+---------------+-----------------+---------------------+
| TABLE_CATALOG | TABLE_SCHEMA       | TABLE_NAME | PARENT_TABLE_NAME | ON_DELETE_ACTION | TABLE_TYPE | SPANNER_STATE | INTERLEAVE_TYPE | ROW_DELETION_POLICY |
| STRING        | STRING             | STRING     | STRING            | STRING           | STRING     | STRING        | STRING          | _EXPRESSION         |
|               |                    |            |                   |                  |            |               |                 | STRING              |
+---------------+--------------------+------------+-------------------+------------------+------------+---------------+-----------------+---------------------+
|               | INFORMATION_SCHEMA | VIEWS      | NULL              | NULL             | VIEW       | NULL          |                 | NULL                |
|               | INFORMATION_SCHEMA | INDEX_COLU | NULL              | NULL             | VIEW       | NULL          |                 | NULL                |
|               |                    | MNS        |                   |                  |            |               |                 |                     |
|               | INFORMATION_SCHEMA | KEY_COLUMN | NULL              | NULL             | VIEW       | NULL          |                 | NULL                |
|               |                    | _USAGE     |                   |                  |            |               |                 |                     |
|               | INFORMATION_SCHEMA | SCHEMATA   | NULL              | NULL             | VIEW       | NULL          |                 | NULL                |
|               | INFORMATION_SCHEMA | SPANNER_ST | NULL              | NULL             | VIEW       | NULL          |                 | NULL                |
|               |                    | ATISTICS   |                   |                  |            |               |                 |                     |
|               | INFORMATION_SCHEMA | MODEL_COLU | NULL              | NULL             | VIEW       | NULL          |                 | NULL                |
|               |                    | MNS        |                   |                  |            |               |                 |                     |
|               | INFORMATION_SCHEMA | INDEXES    | NULL              | NULL             | VIEW       | NULL          |                 | NULL                |
|               | INFORMATION_SCHEMA | TABLE_CONS | NULL              | NULL             | VIEW       | NULL          |                 | NULL                |
|               |                    | TRAINTS    |                   |                  |            |               |                 |                     |
|               | INFORMATION_SCHEMA | TABLES     | NULL              | NULL             | VIEW       | NULL          |                 | NULL                |
|               | INFORMATION_SCHEMA | MODELS     | NULL              | NULL             | VIEW       | NULL          |                 | NULL                |
+---------------+--------------------+------------+-------------------+------------------+------------+---------------+-----------------+---------------------+

@apstndb apstndb merged commit 9a42092 into main Nov 5, 2024
2 checks passed
@apstndb apstndb deleted the feature/adjust-multiline-cell branch November 5, 2024 04:17
@apstndb apstndb changed the title Implement autowrapping and adjusting column width Implement autowrapping and autoadjusting column width Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant