Software / code / prosody
Changeset
10907:6af28c756752
util.human.io: Draw a separator between columns
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 04 Jun 2020 18:31:50 +0200 |
| parents | 10906:a1fed82c44b9 |
| children | 10908:18dc4639442e |
| files | util/human/io.lua |
| diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/util/human/io.lua Thu Jun 04 17:30:44 2020 +0100 +++ b/util/human/io.lua Thu Jun 04 18:31:50 2020 +0200 @@ -97,9 +97,10 @@ local function new_table(col_specs, max_width) max_width = max_width or tonumber(os.getenv("COLUMNS")) or 80; + local separator = " | "; local widths = {}; - local total_width = max_width; + local total_width = max_width - #separator * (#col_specs-1); local free_width = total_width; -- Calculate width of fixed-size columns for i = 1, #col_specs do @@ -137,7 +138,7 @@ end table.insert(output, v); end - return table.concat(output); + return table.concat(output, separator); end; end