Mercurial > prosody-hg
comparison util/prosodyctl/shell.lua @ 13047:d939bf469057
util.human.io: Prefer using the $COLUMNS environment variable if set (by readline)
Feels like it should be faster.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 07 Apr 2023 13:42:20 +0200 |
| parents | 4c3dc767fb11 |
| children | 4ae759490e31 |
comparison
equal
deleted
inserted
replaced
| 13046:4c3dc767fb11 | 13047:d939bf469057 |
|---|---|
| 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) |
| 33 client.send(st.stanza("repl-input", { width = os.getenv "COLUMNS" or term_width() }):text(line)); | 33 client.send(st.stanza("repl-input", { width = term_width() }):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 |
