util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lennard Hofmann <lennard.hofmann@web.de>
To: util-linux@vger.kernel.org
Cc: Lennard Hofmann <lennard.hofmann@web.de>
Subject: [PATCH 3/4] column: Deprecate --table-empty-lines in favor of --keep-empty-lines
Date: Sun, 20 Sep 2020 15:08:18 +0200	[thread overview]
Message-ID: <20200920130818.29756-2-lennard.hofmann@web.de> (raw)
In-Reply-To: <20200920130818.29756-1-lennard.hofmann@web.de>

`--table-empty-lines` gives the false impression that the option
only applies to table mode.

Signed-off-by: Lennard Hofmann <lennard.hofmann@web.de>
---
 text-utils/column.1 | 8 +++++---
 text-utils/column.c | 9 +++++----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/text-utils/column.1 b/text-utils/column.1
index 86886f3bf..d10fc7efb 100644
--- a/text-utils/column.1
+++ b/text-utils/column.1
@@ -110,9 +110,11 @@ hide all unnamed columns (see \-\-table-columns).
 Specify columns order on output.
 .IP "\fB\-n, \-\-table-name\fP \fIname\fP"
 Specify the table name used for JSON output. The default is "table".
-.IP "\fB\-L, \-\-table\-empty\-lines\fP"
-Insert empty line to the table for each empty line on input. The default
-is ignore empty lines at all.
+.IP "\fB\-L, \-\-keep\-empty\-lines\fP"
+Preserve whitespace-only lines in the input. The default is ignore empty lines
+at all. This option’s original name was \-\-table-empty-lines but is now
+deprecated because it gives the false impression that the option only applies
+to table mode.
 .IP "\fB\-r, \-\-tree\fP \fIcolumn\fP"
 Specify column to use tree-like output. Note that the circular dependencies and
 other anomalies in child and parent relation are silently ignored.
diff --git a/text-utils/column.c b/text-utils/column.c
index d83d8d6d7..bc0c1fd11 100644
--- a/text-utils/column.c
+++ b/text-utils/column.c
@@ -96,7 +96,7 @@ struct column_control {
 	unsigned int greedy :1,
 		     json :1,
 		     header_repeat :1,
-		     tab_empty_lines :1,	/* --table-empty-lines */
+		     keep_empty_lines :1,	/* --keep-empty-lines */
 		     tab_noheadings :1;
 };

@@ -531,7 +531,7 @@ static int read_input(struct column_control *ctl, FILE *fp)
 				*p = '\0';
 		}
 		if (!str || !*str) {
-			if (ctl->tab_empty_lines) {
+			if (ctl->keep_empty_lines) {
 				if (ctl->mode == COLUMN_MODE_TABLE)
 					add_emptyline_to_table(ctl);
 				else
@@ -709,6 +709,7 @@ int main(int argc, char **argv)
 		{ "fillrows",            no_argument,       NULL, 'x' },
 		{ "help",                no_argument,       NULL, 'h' },
 		{ "json",                no_argument,       NULL, 'J' },
+		{ "keep-empty-lines",    no_argument,       NULL, 'L' },
 		{ "output-separator",    required_argument, NULL, 'o' },
 		{ "output-width",        required_argument, NULL, 'c' },
 		{ "separator",           required_argument, NULL, 's' },
@@ -723,7 +724,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-empty-lines",   no_argument,       NULL, 'L' },
+		{ "table-empty-lines",   no_argument,       NULL, 'L' }, /* deprecated */
 		{ "table-header-repeat", no_argument,       NULL, 'e' },
 		{ "tree",                required_argument, NULL, 'r' },
 		{ "tree-id",             required_argument, NULL, 'i' },
@@ -774,7 +775,7 @@ int main(int argc, char **argv)
 			ctl.mode = COLUMN_MODE_TABLE;
 			break;
 		case 'L':
-			ctl.tab_empty_lines = 1;
+			ctl.keep_empty_lines = 1;
 			break;
 		case 'l':
 			ctl.maxncols = strtou32_or_err(optarg, _("invalid columns limit argument"));
--
2.28.0


  reply	other threads:[~2020-09-20 13:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-20 13:08 [PATCH 2/4] column: Call mbs_to_wcs("") only once Lennard Hofmann
2020-09-20 13:08 ` Lennard Hofmann [this message]
2020-09-21 13:08   ` [PATCH 3/4] column: Deprecate --table-empty-lines in favor of --keep-empty-lines Karel Zak
2020-09-20 13:08 ` [PATCH 4/4] tests: column --keep-empty-lines in cols mode Lennard Hofmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200920130818.29756-2-lennard.hofmann@web.de \
    --to=lennard.hofmann@web.de \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).