]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
column: improve --table-hide
authorKarel Zak <kzak@redhat.com>
Wed, 8 Jun 2022 09:31:57 +0000 (11:31 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 8 Jun 2022 09:31:57 +0000 (11:31 +0200)
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 <kzak@redhat.com>
text-utils/column.c

index d8eae9ee5942a034643eabb76570891b83c147f8..50b24bd58dab31f53fffe18dec63e4235605f06d 100644 (file)
@@ -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)