aboutsummaryrefslogtreecommitdiffstats
path: root/util/human
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-06-03 22:58:29 +0100
committerMatthew Wild <mwild1@gmail.com>2020-06-03 22:58:29 +0100
commitf9afa34c93a18fad6fd667e176cd5d1fe6c359c0 (patch)
treee34755532eefc6af3aff4b0df0ac11c390d07647 /util/human
parent7c813b45d875f59e43a357736ac6b3716b112ed8 (diff)
downloadprosody-f9afa34c93a18fad6fd667e176cd5d1fe6c359c0.tar.gz
prosody-f9afa34c93a18fad6fd667e176cd5d1fe6c359c0.zip
util.human.io: table: Return title row when no row data passed
Diffstat (limited to 'util/human')
-rw-r--r--util/human/io.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/human/io.lua b/util/human/io.lua
index dfed3b09..8c328c14 100644
--- a/util/human/io.lua
+++ b/util/human/io.lua
@@ -1,3 +1,5 @@
+local array = require "util.array";
+
local function getchar(n)
local stty_ret = os.execute("stty raw -echo 2>/dev/null");
local ok, char;
@@ -119,6 +121,9 @@ local function new_table(col_specs, max_width, padding)
end
return function (row)
+ if not row then
+ row = array.pluck(col_specs, "title");
+ end
local output = {};
for i, column in ipairs(col_specs) do
local width = widths[i];