From 45966bcf8ed92d67434b6592be44c58440eefcc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 18 Aug 2026 20:47:25 +0200 Subject: [PATCH] report-basic: convert to VERB_COMMAND and add --introspect-cli The custom help() is replaced by a COMMAND() description, and --introspect-cli is added. The abstract gets a trailing period. There is no man page for this helper, so none is referenced. --- src/report/report-basic-server.c | 35 ++++++------------- .../units/TEST-74-AUX-UTILS.introspect-cli.sh | 1 + 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/report/report-basic-server.c b/src/report/report-basic-server.c index e65481a190..4db1552a55 100644 --- a/src/report/report-basic-server.c +++ b/src/report/report-basic-server.c @@ -1,16 +1,20 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include "sd-json.h" #include "sd-varlink.h" -#include "ansi-color.h" #include "build.h" -#include "format-table.h" #include "log.h" #include "main-func.h" -#include "options.h" #include "report-basic.h" #include "varlink-io.systemd.Metrics.h" #include "varlink-util.h" +#include "verbs.h" + +COMMAND( + "systemd-report-basic\0", + "Generate a report describing the current system.", +); static int vl_server(void) { _cleanup_(sd_varlink_server_unrefp) sd_varlink_server *vs = NULL; @@ -38,26 +42,6 @@ static int vl_server(void) { return 0; } -static int help(void) { - _cleanup_(table_unrefp) Table *options = NULL; - int r; - - r = option_parser_get_help_table(&options); - if (r < 0) - return r; - - printf("%s [OPTIONS...]\n" - "\n%sGenerate a report describing the current system%s\n" - "\n%sOptions:%s\n", - program_invocation_short_name, - ansi_highlight(), - ansi_normal(), - ansi_underline(), - ansi_normal()); - - return table_print_or_warn(options); -} - static int parse_argv(int argc, char *argv[]) { int r; @@ -69,10 +53,13 @@ static int parse_argv(int argc, char *argv[]) { FOREACH_OPTION_OR_RETURN(c, &opts) switch (c) { OPTION_COMMON_HELP: - return help(); + return command_print_help("systemd-report-basic"); OPTION_COMMON_VERSION: return version(); + + OPTION_COMMON_INTROSPECT_CLI: + return introspect_cli(SD_JSON_FORMAT_OFF); } if (option_parser_get_n_args(&opts) > 0) diff --git a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh index 8b3da23052..aecc77de64 100755 --- a/test/units/TEST-74-AUX-UTILS.introspect-cli.sh +++ b/test/units/TEST-74-AUX-UTILS.introspect-cli.sh @@ -88,6 +88,7 @@ INTROSPECTABLE=( systemd-random-seed systemd-repart systemd-report + systemd-report-basic systemd-run systemd-sbsign systemd-sleep