From: Karel Zak Date: Wed, 8 Jun 2022 09:31:57 +0000 (+0200) Subject: column: improve --table-hide X-Git-Tag: v2.39-rc1~619 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d83a5f8c2b49b9f3a3c01d43c10286fbe463161e;p=thirdparty%2Futil-linux.git column: improve --table-hide This option affects list of visible columns, so it's better to apply it before any other flags, because "-1" placeholder depends on visible columns. For example: echo "A B C D" | column --table --table-maxout --table-right -1 --table-hide 4 needs to hide column #4 (D) and align #3 (C) to the right. Signed-off-by: Karel Zak --- diff --git a/text-utils/column.c b/text-utils/column.c index d8eae9ee59..50b24bd58d 100644 --- a/text-utils/column.c +++ b/text-utils/column.c @@ -455,6 +455,10 @@ static void modify_table(struct column_control *ctl) scols_table_set_termforce(ctl->tab, SCOLS_TERMFORCE_ALWAYS); } + if (ctl->tab_colhide) + apply_columnflag_from_list(ctl, ctl->tab_colhide, + SCOLS_FL_HIDDEN , _("failed to parse --table-hide list")); + if (ctl->tab_colright) apply_columnflag_from_list(ctl, ctl->tab_colright, SCOLS_FL_RIGHT, _("failed to parse --table-right list")); @@ -471,10 +475,6 @@ static void modify_table(struct column_control *ctl) apply_columnflag_from_list(ctl, ctl->tab_colwrap, SCOLS_FL_WRAP , _("failed to parse --table-wrap list")); - if (ctl->tab_colhide) - apply_columnflag_from_list(ctl, ctl->tab_colhide, - SCOLS_FL_HIDDEN , _("failed to parse --table-hide list")); - if (!ctl->tab_colnoextrem) { struct libscols_column *cl = get_last_visible_column(ctl); if (cl)