]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsclocks: add support for LSCLOCKS_COLUMNS environmental variable
authorChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Sun, 31 Aug 2025 00:04:49 +0000 (20:04 -0400)
committerChristian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Tue, 2 Sep 2025 19:33:23 +0000 (15:33 -0400)
This provides an alternate way to specify output columns similar
to the --output option.

Addresses: #2816
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
misc-utils/lsclocks.1.adoc
misc-utils/lsclocks.c

index fd9ca96df8abea3eb11d3afc1addb5652c3b0533..ebe0b13531f74733fd295c2d28888904d125c0de 100644 (file)
@@ -66,6 +66,11 @@ Can be specified multiple times.
 Also display CPU clock of specified process.
 Can be specified multiple times.
 
+== ENVIRONMENT
+
+LSCLOCKS_COLUMNS=::
+Specifies a comma-separated list of output columns to print. All columns listed in *OUTPUT COLUMNS* can be used.
+
 include::man-common/help-version.adoc[]
 
 == OUTPUT COLUMNS
index aeecddec91ac39d41bb8e4203dc01ae0dc095d43..1d4f567bb33557f74530572d605d467665e6998f 100644 (file)
@@ -667,6 +667,8 @@ int main(int argc, char **argv)
                columns[ncolumns++] = COL_ISO_TIME;
        }
 
+       if (!outarg)
+               outarg = getenv("LSCLOCKS_COLUMNS");
        if (outarg && string_add_to_idarray(outarg, columns, ARRAY_SIZE(columns),
                                            &ncolumns, column_name_to_id) < 0)
                return EXIT_FAILURE;