From 785e5436458abe220f08c086a13f333f093b2167 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 13 Nov 2017 12:56:21 +0100 Subject: column: add --table-noheadings Signed-off-by: Karel Zak --- text-utils/column.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'text-utils/column.c') diff --git a/text-utils/column.c b/text-utils/column.c index d34cfc3f0..0a17c69cb 100644 --- a/text-utils/column.c +++ b/text-utils/column.c @@ -93,7 +93,8 @@ struct column_control { unsigned int greedy :1, json :1, - header_repeat :1; + header_repeat :1, + tab_noheadings :1; }; static size_t width(const wchar_t *str) @@ -218,6 +219,7 @@ static void init_table(struct column_control *ctl) scols_table_new_column(ctl->tab, *name, 0, 0); if (ctl->header_repeat) scols_table_enable_header_repeat(ctl->tab, 1); + scols_table_enable_noheadings(ctl->tab, !!ctl->tab_noheadings); } else scols_table_enable_noheadings(ctl->tab, 1); } @@ -572,6 +574,7 @@ static void __attribute__((__noreturn__)) usage(void) 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(_(" -d, --table-noheadings don't print header\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); @@ -622,6 +625,7 @@ int main(int argc, char **argv) { "table-hide", required_argument, NULL, 'H' }, { "table-name", required_argument, NULL, 'n' }, { "table-noextreme", required_argument, NULL, 'E' }, + { "table-noheadings", no_argument, NULL, 'd' }, { "table-order", required_argument, NULL, 'O' }, { "table-right", required_argument, NULL, 'R' }, { "table-truncate", required_argument, NULL, 'T' }, @@ -648,7 +652,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:eH:hi:JN:n:O:o:p:R:r:s:T:tVW:x", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "c:dE:eH:hi:JN:n:O:o:p:R:r:s:T:tVW:x", longopts, NULL)) != -1) { err_exclusive_options(c, longopts, excl, excl_st); @@ -656,6 +660,9 @@ int main(int argc, char **argv) case 'c': ctl.termwidth = strtou32_or_err(optarg, _("invalid columns argument")); break; + case 'd': + ctl.tab_noheadings = 1; + break; case 'E': ctl.tab_colnoextrem = optarg; break; -- cgit v1.2.3-55-g7522