Skip to content

Commit

Permalink
console: configure continuation
Browse files Browse the repository at this point in the history
Continuation marker can be set up with `\set continuation` command.
Works on both server and client side in any language.

Closes tarantool#4317
Requires tarantool#7357

@TarantoolBot document
Title: introduce line carrying slash

Now we can use multiline commands with lines ending by configuring
continuation symbol. Works only when there is no set delimiter.
There is also an alias `\set c on|off`, that does the same.
Consider the example where the marker is set, used and removed:
```
tarantool> \set continuation on
---
- true
...

tarantool> a = 10\
         > + 12
---
...

tarantool> \set c off
---
- true
...

tarantool> a = 10\
---
- error: '[string "a = 10\"]:1: unexpected symbol near ''\'''
...

tarantool>

```
  • Loading branch information
Lord-KA committed Feb 28, 2023
1 parent a4d6387 commit 48683f9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/box/lua/console.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ local continuation_symbol = '\\'

local default_local_eos = ''

-- Each but the last string of multiline command should end with this string.
local continuation_symbol = '\\'

output_handlers["yaml"] = function(status, _opts, ...)
local err, ok, res
-- Using pcall, because serializer can raise an exception
Expand Down Expand Up @@ -593,7 +596,7 @@ local function wrap_text_socket(connection, url, print_f)
eos = current_eos(),
fmt = current_output()["fmt"],
local_eos = default_local_eos,
continuation_on = false,
continuation_on = false
}, text_connection_mt)
--
-- Prepare the connection: setup EOS symbol
Expand Down

0 comments on commit 48683f9

Please sign in to comment.