Skip to content

Commit bda71ea

Browse files
authored
Use Ctrl+C to discard the input in console (#3113)
* Add table with shortcuts * Add admonition * Minor fixes
1 parent de5f4fb commit bda71ea

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

doc/reference/interactive_console.rst

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ or start :ref:`tarantoolctl <tarantoolctl>` with ``enter``.
1212
The interactive console is often called the Lua console to distinguish it from the administrative console,
1313
but in fact it can handle both Lua and SQL input.
1414

15-
The majority of examples in this manual show what users see with the
16-
interactive console, including the prompt (which can be ``tarantool>``),
17-
the instruction (which can be a Lua request or an SQL statement),
18-
and the response (which can be a display in either YAML format or Lua format).
15+
The majority of examples in this manual show what users see with the interactive console.
16+
It includes:
17+
18+
* ``tarantool>`` prompt
19+
* instruction (a Lua request or an SQL statement)
20+
* response (a display in either YAML or Lua format)
1921

2022
.. code-block:: none
2123
22-
-- Typical interactive console example with Lua input and YAML output
24+
-- Interactive console example with Lua input and YAML output
2325
tarantool> box.info().replication
2426
---
2527
- 1:
@@ -28,19 +30,22 @@ and the response (which can be a display in either YAML format or Lua format).
2830
lsn: 0
2931
...
3032
33+
.. _interactive_console_input_output:
34+
35+
Interactive console input and output
36+
------------------------------------
37+
3138
The **input language** can be changed to SQL with ``\set language sql``
3239
or changed to Lua (the default) with ``\set language lua``.
3340

3441
The **delimiter** can be changed to any character with :samp:`\set delimiter <character>`.
3542
The default is nothing, which means input does not need to end with a delimiter.
3643
But a common recommendation is to say ``set delimiter ;`` especially if input is SQL.
3744

38-
.. _interactive_console_output:
39-
4045
The **output format** can be changed to Lua with ``\set output lua``
4146
or changed to YAML (the default) with ``\set output yaml``.
4247

43-
Ordinarily. output from the console has `YAML format <http://yaml.org/spec>`_.
48+
Ordinarily, output from the console has `YAML format <http://yaml.org/spec>`_.
4449
That means that there is a line for document-start ``"---"``,
4550
and each item begins on a separate line starting with ``"- "``,
4651
and each sub-item in a nested structure is indented,
@@ -54,7 +59,7 @@ So, when input is a Lua object description, output will equal input.
5459

5560
YAML is good for readability.
5661
Lua is good for re-using results as requests.
57-
A third format, MsgPack, is good for database storage.
62+
The third format, MsgPack, is good for database storage.
5863
Currently the default output format is YAML but it may be Lua in a future version,
5964
and it may be Lua if
6065
the last :ref:`set_default_output <console-set_default_output>`
@@ -120,3 +125,30 @@ call was ``console.set_default_output('lua')``.
120125
| :code:`...`
121126
122127
- :code:`\x81 \xa3 \x6b \x65 \x79 \x01`
128+
129+
.. _interactive_console-shortcuts:
130+
131+
Keyboard shortcuts
132+
------------------
133+
134+
Since :doc:`2.10.0 </release/2.10.0>`.
135+
136+
.. list-table::
137+
:widths: 25 75
138+
:header-rows: 1
139+
140+
* - Keyboard shortcut
141+
- Effect
142+
143+
* - ``CTRL+C``
144+
- Discard current input with the ``SIGINT`` signal in the console mode and
145+
jump to a new line with a default prompt.
146+
147+
* - ``CTRL+D``
148+
- Quit Tarantool interactive console.
149+
150+
.. important::
151+
152+
Keep in mind that ``CTRL+C`` shortcut will shut Tarantool down if there is any currently running command
153+
in the console.
154+
The :ref:`SIGINT <admin-server_signals>` signal stops the instance running in a daemon mode.

doc/reference/reference_lua/console.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Below is a list of all ``console`` functions.
215215
The output format can be changed within a session by executing
216216
:samp:`console.eval('\\\\set output {yaml}|{lua}')`; see the
217217
description of output format in the
218-
:ref:`Interactive console <interactive_console_output>` section.
218+
:ref:`Interactive console <interactive_console_input_output>` section.
219219

220220
.. _console-eos:
221221

0 commit comments

Comments
 (0)