From d73eaf9e5e6c49fff6262ce326bf193108f45695 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 7 Apr 2023 13:38:59 +0200 Subject: util.prosodyctl.shell: Use new term_width() for width Kicks in if/when readline hasn't set $COLUMNS, e.g. when using the `prosodyctl shell command like this` form. --- util/prosodyctl/shell.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/prosodyctl/shell.lua b/util/prosodyctl/shell.lua index d48a5ef7..ed102d47 100644 --- a/util/prosodyctl/shell.lua +++ b/util/prosodyctl/shell.lua @@ -6,6 +6,7 @@ local parse_args = require "prosody.util.argparse".parse; local unpack = table.unpack or _G.unpack; local tc = require "prosody.util.termcolours"; local isatty = require "prosody.util.pposix".isatty; +local term_width = require"prosody.util.human.io".term_width; local have_readline, readline = pcall(require, "readline"); @@ -29,7 +30,7 @@ local function read_line(prompt_string) end local function send_line(client, line) - client.send(st.stanza("repl-input", { width = os.getenv "COLUMNS" }):text(line)); + client.send(st.stanza("repl-input", { width = os.getenv "COLUMNS" or term_width() }):text(line)); end local function repl(client) -- cgit v1.2.3