# HG changeset patch # User Matthew Wild # Date 1591221509 -3600 # Node ID d15a4284fdf887014f01839694439283d5ef65a2 # Parent a256044c1d12e1027b40a83dd51d043475bd56b1 util.human.io: table: Return title row when no row data passed diff -r a256044c1d12 -r d15a4284fdf8 util/human/io.lua --- 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];