From d9eddf72a35e8e122de1135e5731198842fa2cac Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 13 Jun 2017 11:14:46 +0200 Subject: column: add --table-header-repeat Signed-off-by: Karel Zak --- text-utils/column.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'text-utils/column.c') diff --git a/text-utils/column.c b/text-utils/column.c index c315f91ef..c036b4de8 100644 --- a/text-utils/column.c +++ b/text-utils/column.c @@ -92,7 +92,8 @@ struct column_control { size_t maxlength; /* longest input record (line) */ unsigned int greedy :1, - json :1; + json :1, + header_repeat :1; }; static size_t width(const wchar_t *str) @@ -205,6 +206,8 @@ static void init_table(struct column_control *ctl) STRV_FOREACH(name, ctl->tab_colnames) scols_table_new_column(ctl->tab, *name, 0, 0); + if (ctl->header_repeat) + scols_table_enable_header_repeat(ctl->tab, 1); } else scols_table_enable_noheadings(ctl->tab, 1); } @@ -559,6 +562,7 @@ static void __attribute__((__noreturn__)) usage(int rc) fputs(_(" -O, --table-order specify order of output columns\n"), out); fputs(_(" -N, --table-columns comma separated columns names\n"), out); fputs(_(" -E, --table-noextreme don't count long text from the columns to column width\n"), out); + fputs(_(" -e, --table-header-repeat repeat header for each page\n"), out); fputs(_(" -H, --table-hide don't print the columns\n"), out); fputs(_(" -R, --table-right right align text in these columns\n"), out); fputs(_(" -T, --table-truncate truncate text in the columns when necessary\n"), out); @@ -613,6 +617,7 @@ int main(int argc, char **argv) { "table-right", required_argument, NULL, 'R' }, { "table-truncate", required_argument, NULL, 'T' }, { "table-wrap", required_argument, NULL, 'W' }, + { "table-header-repeat", no_argument, NULL, 'e' }, { "tree", required_argument, NULL, 'r' }, { "tree-id", required_argument, NULL, 'i' }, { "tree-parent", required_argument, NULL, 'p' }, @@ -634,7 +639,7 @@ int main(int argc, char **argv) ctl.output_separator = " "; ctl.input_separator = mbs_to_wcs("\t "); - while ((c = getopt_long(argc, argv, "c:E:H:hi:JN:n:O:o:p:R:r:s:T:tVW:x", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "c:E:eH:hi:JN:n:O:o:p:R:r:s:T:tVW:x", longopts, NULL)) != -1) { err_exclusive_options(c, longopts, excl, excl_st); @@ -645,6 +650,9 @@ int main(int argc, char **argv) case 'E': ctl.tab_colnoextrem = optarg; break; + case 'e': + ctl.header_repeat = 1; + break; case 'H': ctl.tab_colhide = optarg; break; -- cgit v1.2.3-55-g7522