From 1a54a855f9720cad10a4c47f3f65ad92d239373a Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sun, 17 Sep 2023 23:16:38 -0400 Subject: Added in borders to table output. --- src/lpm.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lpm.lua b/src/lpm.lua index 7a4075d..f755a33 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -1751,13 +1751,13 @@ local function get_table(headers, rows) maxes[k] = math.max(#v, maxes[k] or 0) end end local strs = {} - table.insert(strs, table.concat(common.map(headers, function(v, i) return v .. string.rep(" ", maxes[i] - #v) end), " | ")) - table.insert(strs, table.concat(common.map(headers, function(v, i) return string.rep("-", maxes[i]) end), " | ")) + table.insert(strs, "| " .. table.concat(common.map(headers, function(v, i) return v .. string.rep(" ", maxes[i] - #v) end), " | ") .. " |") + table.insert(strs, "| " .. table.concat(common.map(headers, function(v, i) return string.rep("-", maxes[i]) end), " | ") .. " |") for i,row in ipairs(rows) do - table.insert(strs, table.concat(common.map(row, function(v, i) + table.insert(strs, "| " .. table.concat(common.map(row, function(v, i) if type(v) == "table" then v = table.concat(v, ", ") else v = tostring(v) end return v .. string.rep(" ", maxes[i] - #v) - end), " | ")) + end), " | ") .. " |") end return table.concat(strs, "\n") end -- cgit v1.2.3