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.
--- a/util/prosodyctl/shell.lua Fri Apr 07 12:35:39 2023 +0100
+++ b/util/prosodyctl/shell.lua Fri Apr 07 13:38:59 2023 +0200
@@ -6,6 +6,7 @@
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 @@
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)