comparison util/prosodyctl/shell.lua @ 13939:b1e7d3f571b1

prosodyctl shell: Output TSV when output is not a TTY This is meant to make it easier to use in scripts. CSV would have been nice but requires escaping of fields containing ",", but this implementation simply ignores this and assumes fields will not contain tabs.
author Kim Alvefur <zash@zash.se>
date Sun, 31 Aug 2025 00:47:25 +0200
parents c8e534b4f2e2
children 3326c8a29a86
comparison
equal deleted inserted replaced
13938:88f5ea4c28ce 13939:b1e7d3f571b1
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, interactive) 32 local function send_line(client, line, interactive)
33 client.send(st.stanza("repl-input", { width = tostring(term_width()), repl = interactive == false and "0" or "1" }):text(line)); 33 client.send(st.stanza("repl-input", { width = tostring(term_width(-1)), 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