Skip to content

Commit d1b3132

Browse files
committed
Add tt console docs
1 parent ee7f03d commit d1b3132

File tree

2 files changed

+67
-44
lines changed

2 files changed

+67
-44
lines changed

doc/reference/tooling/tt_cli/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ concept explanation, and the ``tt`` command reference.
2727
global_options
2828
commands
2929
external_modules
30+
tt_interactive_console
3031

3132
.. _tt-cli-environments:
3233

doc/reference/tooling/tt_cli/tt_interactive_console.rst

Lines changed: 66 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,17 @@ tt interactive console
55

66
Intro: tt connect. + take some desc from tarantool console page
77

8-
The ``tt`` utility features an interactive console
9-
10-
??? relation to tarantool console :ref:`Tarantool interactive console <interactive_console>`
11-
??? node specific
12-
??? link from tt connect ref
13-
14-
??? Sections: input and output?
15-
16-
completion (after require)
8+
The ``tt`` utility features an command-line console that allows working interactively
9+
in the connected Tarantool instances. It is pretty similar to the :ref:`Tarantool interactive console <interactive_console>`,
10+
but allows connecting to any available instance (both local and remote) and provides
11+
wider formatting capabilities.
1712

1813
.. _tt-interactive-console-enter:
1914

2015
Entering the console
2116
--------------------
2217

23-
To connect to a Tarantool instance using the ``tt`` console, run :ref:``tt connect <tt-connect>``.
18+
To connect to a Tarantool instance using the ``tt`` console, run :ref:`tt connect <tt-connect>`.
2419
Specify the instance URI and connection options, such as the username and the password,
2520
in the corresponding options.
2621

@@ -32,7 +27,7 @@ in the corresponding options.
3227
3328
192.168.10.10:3301>
3429
35-
If connecting to an instance from the same ``tt`` environment, you can use the ``<application>:<instance>``
30+
When connecting to an instance from the same ``tt`` environment, you can use the ``<application>:<instance>``
3631
string instead of the URI:
3732

3833
.. code-block:: console
@@ -88,6 +83,8 @@ language, run ``\set language <language>``, for example:
8883
8984
$ tt connect app:storage001 -l sql
9085
86+
For Lua input, the tab-based autocompletion is available.
87+
9188
.. set delimiter??
9289
9390
.. _tt-interactive-console-output:
@@ -98,9 +95,9 @@ Console output
9895
By default, the ``tt`` console prints the output data in the YAML format, each
9996
tuple on the new line.
10097

101-
.. code-block::console
98+
.. code-block:: console
10299
103-
myapp:instance001> box.space.bands:select { }
100+
app:storage001> box.space.bands:select { }
104101
---
105102
- - [1, 'Roxette', 1986]
106103
- [2, 'Scorpions', 1965]
@@ -110,13 +107,13 @@ tuple on the new line.
110107
You can switch to alternative output formats: Lua or human-readable tables using
111108
the ``\set output`` console command:
112109

113-
.. code-block::console
110+
.. code-block:: console
114111
115-
myapp:instance001> \set output lua
116-
myapp:instance001> box.space.bands:select { }
112+
app:storage001> \set output lua
113+
app:storage001> box.space.bands:select { }
117114
{{1, "Roxette", 1986}, {2, "Scorpions", 1965}, {3, "Ace of Base", 1987}};
118-
myapp:instance001> \set output table
119-
myapp:instance001> box.space.bands:select { }
115+
app:storage001> \set output table
116+
app:storage001> box.space.bands:select { }
120117
+------+-------------+------+
121118
| col1 | col2 | col3 |
122119
+------+-------------+------+
@@ -132,8 +129,8 @@ are arranged in columns instead of rows:
132129

133130
.. code-block::console
134131
135-
myapp:instance001> \set output ttable
136-
myapp:instance001> box.space.bands:select { }
132+
app:storage001> \set output ttable
133+
app:storage001> box.space.bands:select { }
137134
+------+---------+-----------+-------------+
138135
| col1 | 1 | 2 | 3 |
139136
+------+---------+-----------+-------------+
@@ -142,6 +139,15 @@ are arranged in columns instead of rows:
142139
| col3 | 1986 | 1965 | 1987 |
143140
+------+---------+-----------+-------------+
144141
142+
.. note::
143+
144+
You can also specify the output format in the ``tt connect`` call using the
145+
``-x``/``--outputformat`` option.
146+
147+
.. code-block:: console
148+
149+
$ tt connect app:storage001 -x table
150+
145151
For ``table`` and ``ttable`` output, more customizations are possible with the
146152
following commands:
147153

@@ -152,20 +158,20 @@ following commands:
152158

153159
.. code-block::console
154160
155-
myapp:instance001> \set table_format jira
156-
myapp:instance001> box.space.bands:select {}
161+
app:storage001> \set table_format jira
162+
app:storage001> box.space.bands:select {}
157163
| col1 | 1 | 2 | 3 |
158164
| col2 | Roxette | Scorpions | Ace of Base |
159165
| col3 | 1986 | 1965 | 1987 |
160-
myapp:instance001> \set table_format default
161-
myapp:instance001> \set graphics false
162-
myapp:instance001> box.space.bands:select {}
166+
app:storage001> \set table_format default
167+
app:storage001> \set graphics false
168+
app:storage001> box.space.bands:select {}
163169
col1 1 2 3
164170
col2 Roxette Scorpions Ace of Base
165171
col3 1986 1965 1987
166172
167-
myapp:instance001> \set table_column_width 6
168-
myapp:instance001> box.space.bands:select {}
173+
app:storage001> \set table_column_width 6
174+
app:storage001> box.space.bands:select {}
169175
col1 1 2 3
170176
col2 Roxett Scorpi Ace of
171177
+e +ons + Base
@@ -177,26 +183,31 @@ following commands:
177183
Commands
178184
--------
179185

180-
\help, ?
181-
~~~~~
186+
\\help, ?
187+
~~~~~~~~~
182188

183189
Show help on the ``tt`` console.
184190

185-
\quit, \q
186-
~~~~~~~~~
191+
\\quit, \\q
192+
~~~~~~~~~~~
187193

188194
Quit the ``tt`` console.
189195

190-
\set language {lua|sql}
191-
~~~~~~~~~~~~~~~~~~~~~~~
196+
\\shortcuts
197+
~~~~~~~~~~~
198+
199+
Show available keyboard shortcuts
200+
201+
\\set language {lua|sql}
202+
~~~~~~~~~~~~~~~~~~~~~~~~
192203

193204
Set the input language: Lua or SQL.
194205
Possible values: ``lua`` (default), ``sql``.
195206

196207
An analog of the :ref:``tt connect <tt-connect>`` option ``-l``/``--language``
197208

198-
\set output [FORMAT], \x[l|t|T|y], \x
199-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
209+
\\set output FORMAT, \\x{l|t|T|y}, \\x
210+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200211

201212
Set the output format.
202213
Possible ``FORMAT`` values:
@@ -220,24 +231,35 @@ The format of ``table`` and ``ttable`` output can be adjusted using the :ref:`\s
220231

221232
An analog of the :ref:``tt connect <tt-connect>`` option ``-x``/``--outputformat``
222233

223-
\set table_format
224-
~~~~~~~~~~~~~~~~~
234+
\\set table_format
235+
~~~~~~~~~~~~~~~~~~
236+
237+
Set the table format if the output format is ``table`` or ``ttable``.
238+
Possible values:
225239

226-
Set the table format if the output format is ``table`` or ``ttable``:
227-
default, Markdown, or jira.
240+
* ``default`` -- a pseudographics (ASCII) table.
241+
* ``markdown`` -- a table in the Markdown format
242+
* ``jira`` -- a Jira-compatible table
228243

229-
\set graphics {true|false}, \x{g|G}
230-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
244+
\\set graphics {true|false}, \\x{g|G}
245+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
231246

232247
Whether to print pseudographics for table cells if the output format is ``table`` or ``ttable``.
233-
Possible values: ``true`` and ``false``.
248+
Possible values: ``true`` (default) and ``false``.
234249

235-
\set table_colum_width WIDTH, \xw WIDTH
236-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
250+
The shorthands are:
251+
252+
* ``\xG`` for ``true``
253+
* ``\xg`` for ``false``
254+
255+
\\set table_colum_width WIDTH, \\xw WIDTH
256+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237257

238258
Set maximum printed width of a table cell content. If the length exceeds this value,
239259
it continues on the next line starting from +
240260

261+
Shorthand: ``\xw``
262+
241263
.. _tt-interactive-console-shortcuts:
242264

243265
Shortcuts

0 commit comments

Comments
 (0)