]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect: add a bit of color to --discover table
authorLennart Poettering <lennart@poettering.net>
Tue, 12 Nov 2024 11:48:54 +0000 (12:48 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 3 Jan 2025 09:13:13 +0000 (10:13 +0100)
src/dissect/dissect.c

index cdc4f770159ef4a580245d74121268009cf9357f..3ca81a6a218588bee593fbe83c2d8c656097b0fd 100644 (file)
@@ -1903,12 +1903,15 @@ static int action_discover(void) {
                 r = table_add_many(
                                 t,
                                 TABLE_STRING, img->name,
+                                TABLE_SET_COLOR, startswith(img->name, ".") ? ANSI_GREY : NULL,
                                 TABLE_STRING, image_type_to_string(img->type),
                                 TABLE_STRING, image_class_to_string(img->class),
                                 TABLE_BOOLEAN, img->read_only,
+                                TABLE_SET_COLOR, !img->read_only ? ANSI_HIGHLIGHT_GREEN : ANSI_HIGHLIGHT_RED,
                                 TABLE_PATH, img->path,
                                 TABLE_TIMESTAMP, img->mtime != 0 ? img->mtime : img->crtime,
-                                TABLE_SIZE, img->usage);
+                                TABLE_SIZE, img->usage,
+                                TABLE_SET_COLOR, img->usage <= 0 ? ANSI_HIGHLIGHT_RED : NULL);
                 if (r < 0)
                         return table_log_add_error(r);
         }