boot-check-no-failures: convert to VERB_COMMAND and add --introspect-cli

The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-08-17 13:21:31 +02:00
parent 494701162f
commit ec964d79cb
2 changed files with 12 additions and 33 deletions
+11 -33
View File
@@ -1,44 +1,19 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h>
#include "sd-bus.h"
#include "sd-json.h"
#include "alloc-util.h"
#include "build.h"
#include "bus-error.h"
#include "format-table.h"
#include "log.h"
#include "main-func.h"
#include "options.h"
#include "pretty-print.h"
#include "verbs.h"
static int help(void) {
_cleanup_free_ char *link = NULL;
_cleanup_(table_unrefp) Table *options = NULL;
int r;
r = terminal_urlify_man("systemd-boot-check-no-failures.service", "8", &link);
if (r < 0)
return log_oom();
r = option_parser_get_help_table(&options);
if (r < 0)
return r;
printf("%s [OPTIONS...]\n"
"\n%sVerify system operational state.%s\n\n",
program_invocation_short_name,
ansi_highlight(),
ansi_normal());
r = table_print_or_warn(options);
if (r < 0)
return r;
printf("\nSee the %s for details.\n", link);
return 0;
}
COMMAND(
"systemd-boot-check-no-failures\0",
"Verify system operational state.",
.man_pages = "systemd-boot-check-no-failures.service.8\0",
);
static int parse_argv(int argc, char *argv[]) {
assert(argc >= 0);
@@ -50,10 +25,13 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
OPTION_COMMON_HELP:
return help();
return command_print_help("systemd-boot-check-no-failures");
OPTION_COMMON_VERSION:
return version();
OPTION_COMMON_INTROSPECT_CLI:
return introspect_cli(SD_JSON_FORMAT_OFF);
}
return 1;
@@ -19,6 +19,7 @@ INTROSPECTABLE=(
systemd-backlight
systemd-battery-check
systemd-binfmt
systemd-boot-check-no-failures
systemd-bsod
systemd-cat
systemd-cgls