Software / code / prosody
Comparison
util/prosodyctl/shell.lua @ 13771:5f26164c738f
Merge 13.0->trunk
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 13 Mar 2025 11:41:32 +0000 |
| parent | 13770:a28349b8a387 |
| child | 13796:c8e534b4f2e2 |
comparison
equal
deleted
inserted
replaced
| 13766:b11242656300 | 13771:5f26164c738f |
|---|---|
| 27 io.write(prompt_string); | 27 io.write(prompt_string); |
| 28 return io.read("*line"); | 28 return io.read("*line"); |
| 29 end | 29 end |
| 30 end | 30 end |
| 31 | 31 |
| 32 local function send_line(client, line) | 32 local function send_line(client, line, interactive) |
| 33 client.send(st.stanza("repl-input", { width = tostring(term_width()) }):text(line)); | 33 client.send(st.stanza("repl-input", { width = tostring(term_width()), repl = interactive == false and "0" or "1" }):text(line)); |
| 34 end | 34 end |
| 35 | 35 |
| 36 local function repl(client) | 36 local function repl(client) |
| 37 local line = read_line(client.prompt_string or "prosody> "); | 37 local line = read_line(client.prompt_string or "prosody> "); |
| 38 if not line or line == "quit" or line == "exit" or line == "bye" then | 38 if not line or line == "quit" or line == "exit" or line == "bye" then |
| 89 if arg[2] then | 89 if arg[2] then |
| 90 arg[1] = ("{"..string.rep("%q", #arg, ", ").."}"):format(table.unpack(arg, 1, #arg)); | 90 arg[1] = ("{"..string.rep("%q", #arg, ", ").."}"):format(table.unpack(arg, 1, #arg)); |
| 91 end | 91 end |
| 92 | 92 |
| 93 client.events.add_handler("connected", function() | 93 client.events.add_handler("connected", function() |
| 94 send_line(client, arg[1]); | 94 send_line(client, arg[1], false); |
| 95 return true; | 95 return true; |
| 96 end, 1); | 96 end, 1); |
| 97 | 97 |
| 98 local errors = 0; -- TODO This is weird, but works for now. | 98 local errors = 0; -- TODO This is weird, but works for now. |
| 99 client.events.add_handler("received", function(stanza) | 99 client.events.add_handler("received", function(stanza) |