aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-04-07 13:38:59 +0200
committerKim Alvefur <zash@zash.se>2023-04-07 13:38:59 +0200
commitd73eaf9e5e6c49fff6262ce326bf193108f45695 (patch)
treeb4cd1f433dd223bb3e506c2f18489fbc36d90ad6 /util
parentb5ff6256b6ea968b77cd157fb55bdd0bd6e1ee3f (diff)
downloadprosody-d73eaf9e5e6c49fff6262ce326bf193108f45695.tar.gz
prosody-d73eaf9e5e6c49fff6262ce326bf193108f45695.zip
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.
Diffstat (limited to 'util')
-rw-r--r--util/prosodyctl/shell.lua3
1 files changed, 2 insertions, 1 deletions
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)