aboutsummaryrefslogtreecommitdiffstats
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
commit7b7084ad68dd4c30998a4e5d79ac0e5d04fb08d6 (patch)
treee34755532eefc6af3aff4b0df0ac11c390d07647
parent8467f4f9eaeeaf1c70c8ee958eb9eb9757c8fb64 (diff)
downloadprosody-7b7084ad68dd4c30998a4e5d79ac0e5d04fb08d6.tar.gz
prosody-7b7084ad68dd4c30998a4e5d79ac0e5d04fb08d6.zip
util.human.io: table: Return title row when no row data passed
-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];