From b1a68327bbfb14b868944c9fa324aa9adc6fe10b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 26 Aug 2026 10:17:06 +0200 Subject: [PATCH] udevadm-wait: use common verb help and add --introspect-cli The custom help() is replaced by the common verb help, which derives the synopsis, abstract, and option list from the verb declaration in udevadm.c and the "udevadm-wait" option namespace. The verb's one-line description from the abstract is retained, I think it is good enough but shorter. --- src/udev/udevadm-wait.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/udev/udevadm-wait.c b/src/udev/udevadm-wait.c index 08c142d5eb..cdee4c8c58 100644 --- a/src/udev/udevadm-wait.c +++ b/src/udev/udevadm-wait.c @@ -4,13 +4,12 @@ #include #include "sd-event.h" +#include "sd-json.h" #include "device-monitor-private.h" #include "device-util.h" #include "event-util.h" -#include "format-table.h" #include "fs-util.h" -#include "help-util.h" #include "options.h" #include "parse-util.h" #include "path-util.h" @@ -21,6 +20,7 @@ #include "time-util.h" #include "udev-util.h" #include "udevadm.h" +#include "verbs.h" typedef enum WaitUntil { WAIT_UNTIL_INITIALIZED, @@ -298,25 +298,6 @@ static int setup_periodic_timer(sd_event *event) { return sd_event_source_set_floating(s, true); } -static int help(void) { - _cleanup_(table_unrefp) Table *options = NULL; - int r; - - r = option_parser_get_help_table_ns("udevadm-wait", &options); - if (r < 0) - return r; - - help_cmdline("wait [OPTIONS] DEVICE [DEVICE…]"); - help_abstract("Wait for devices or device symlinks being created."); - help_section("Options"); - r = table_print_or_warn(options); - if (r < 0) - return r; - - help_man_page_reference("udevadm", "8"); - return 0; -} - static int parse_argv(int argc, char *argv[]) { int r; @@ -331,7 +312,7 @@ static int parse_argv(int argc, char *argv[]) { OPTION_NAMESPACE("udevadm-wait"): {} OPTION_COMMON_HELP: - return help(); + return command_print_verb_help("wait"); OPTION('V', "version", NULL, "Show package version"): return print_version(); @@ -357,6 +338,9 @@ static int parse_argv(int argc, char *argv[]) { OPTION_LONG("settle", NULL, "Also wait for all queued events being processed"): arg_settle = true; break; + + OPTION_COMMON_INTROSPECT_CLI: + return introspect_cli(SD_JSON_FORMAT_OFF); } if (arg_removed)