]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: add support for LSBLK_COLUMNS environmental variable as an alternative to...
authorcgoesche <cgoesc2@wgu.edu>
Sat, 23 Aug 2025 00:26:07 +0000 (20:26 -0400)
committercgoesche <cgoesc2@wgu.edu>
Sat, 23 Aug 2025 00:26:07 +0000 (20:26 -0400)
Addresses: #2816
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
misc-utils/lsblk.8.adoc
misc-utils/lsblk.c

index 04efa276cae86030eb76c9c97ea993f9ef5174b6..4fc6cc6b566078da88e43df6806afec29fcfd484 100644 (file)
@@ -234,6 +234,9 @@ enables *libsmartcols* debug output.
 *LIBSMARTCOLS_DEBUG_PADDING*=on::
 use visible padding characters.
 
+*LSBLK_COLUMNS*=::
+specifies a comma-separated list of output columns to print. All columns listed by *--list-columns* can be used.
+
 == NOTES
 
 For partitions, some information (e.g., queue attributes) is inherited from the parent device.
index 06a206cb926d740e81de70671ef66f84e27003d3..c054c23b47ca9571a076b4d01cd04ff628ffd19f 100644 (file)
@@ -2714,6 +2714,7 @@ int main(int argc, char *argv[])
                add_column(COL_TARGETS);
        }
 
+       outarg = outarg == NULL ? getenv("LSBLK_COLUMNS") : outarg;
        if (outarg && string_add_to_idarray(outarg, columns, ARRAY_SIZE(columns),
                                         &ncolumns, column_name_to_id) < 0)
                return EXIT_FAILURE;