]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysupdate: Improve empty table when printing features
authorPhilip Withnall <pwithnall@gnome.org>
Tue, 2 Jun 2026 10:40:57 +0000 (11:40 +0100)
committerPhilip Withnall <pwithnall@gnome.org>
Tue, 14 Jul 2026 11:09:23 +0000 (12:09 +0100)
Rather than just printing out the table header and then exiting, print
“No features” similarly to what `loginctl` or `storagectl` do.

src/sysupdate/sysupdate.c

index 01b4a03f4d3531550eca87f9a7d5384b6c6b52be..48e1445de25c3c6402647cb6bb1bc1b9f6a2d490 100644 (file)
@@ -1975,7 +1975,16 @@ static int verb_features(int argc, char *argv[], uintptr_t _data, void *userdata
                                 return table_log_add_error(r);
                 }
 
-                return table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, arg_legend);
+                r = table_print_with_pager(table, arg_json_format_flags, arg_pager_flags, arg_legend);
+                if (r < 0)
+                        return r;
+
+                if (arg_legend) {
+                        if (table_isempty(table))
+                                log_info("No features.");
+                        else
+                                printf("\n%zu features listed.\n", table_get_rows(table) - 1);
+                }
         } else {
                 _cleanup_(sd_json_variant_unrefp) sd_json_variant *json = NULL;
                 _cleanup_strv_free_ char **features = NULL;