Software /
code /
prosody
Diff
util/human/io.lua @ 10894:d15a4284fdf8
util.human.io: table: Return title row when no row data passed
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 03 Jun 2020 22:58:29 +0100 |
parent | 10893:a256044c1d12 |
child | 10896:c7a0eab27165 |
line wrap: on
line diff
--- a/util/human/io.lua Wed Jun 03 22:45:33 2020 +0100 +++ b/util/human/io.lua Wed Jun 03 22:58:29 2020 +0100 @@ -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 @@ 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];