Software /
code /
prosody
Changeset
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 |
parents | 10893:a256044c1d12 |
children | 10895:5777968301e8 |
files | util/human/io.lua |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
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];