Skip to content

tt connect interactive console: expanded formatting modes #3734

Closed
@TarantoolBot

Description

@TarantoolBot

Product: tt CLI
Since: ?
Audience/target: all
Root document: ? https://www.tarantool.io/en/doc/latest/reference/tooling/interactive_console/
? https://www.tarantool.io/en/doc/latest/reference/tooling/tt_cli/connect/
SME: @ GRISHNOV

Details

The patchset introduces addition commands for the tt connect console.

It adds several common commands that relate to a general functionality:

  • \help, ? - to show help message with additional information and
    a list of all commands.
  • \quit, \q - quit from the console. Previously this command worked
    on the tarantool side, but now it works on the tt side and does
    not require execution rights for a user.

In addition, the patch adds commands for extended output modes:

  • \set output <format> - set format lua, table, ttable or
    yaml (default)
  • \set table_format <format> - set table format default, jira
    or markdown
  • \set graphics <false/true> - disables/enables (default)
    pseudographics for table modes
  • \set table_column_width <width> - set max column width for
    table/ttable
  • \xw <width> - set max column width for table/ttable
  • \x - switches output format cyclically
  • \x[l,t,T,y] - set output format lua, table, ttable or yaml
  • \x[g,G] - disables/enables pseudographics for table modes

Supported formats:

  1. yaml - shows data as a YAML document. The format is
    used now by tarantool and tt.
  2. lua - shows data as Lua-compatible structs.
  3. table - shows data as a pseudo graphical table.
  4. ttable - the same as the table format, but a result table is
    transposed (rotate data from rows to columns).

Supported table formats (for table or ttable formats):

  1. default - shows data as a pseudo graphical table.
  2. markdown - shows data as a Markdown-compatible table.
  3. jira - shows data as a Jira-compatible table.

Example:

> \set output table
> box.space.customers:select()
+------+-----------+------+
| col1 | col2      | col3 |
+------+-----------+------+
| 1    | Elizabeth | 12   |
+------+-----------+------+
> \xg
> box.space.customers:select()
 col1  col2       col3
 1     Elizabeth  12
 2     Mary       46
 3     David      33

Requested by @GRISHNOV in tarantool/tt@5189d4f.

Definition of done

  • Define the relation between tt console and tarantool console to find the proper place for this doc
  • Describe the new formatting capabilities in the console documentation

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions