diff options
author | Matthew Wild <mwild1@gmail.com> | 2020-06-03 22:58:29 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2020-06-03 22:58:29 +0100 |
commit | f9afa34c93a18fad6fd667e176cd5d1fe6c359c0 (patch) | |
tree | e34755532eefc6af3aff4b0df0ac11c390d07647 /util/human | |
parent | 7c813b45d875f59e43a357736ac6b3716b112ed8 (diff) | |
download | prosody-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.lua | 5 |
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]; |