From d77ecb5c376985a79e9fd9a3d0bc8be502adcc9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 26 Aug 2026 10:16:01 +0200 Subject: [PATCH] udevadm-monitor: 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-monitor" option namespace. --- src/udev/udevadm-monitor.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c index 76c9d16d1f..ef936cb7d1 100644 --- a/src/udev/udevadm-monitor.c +++ b/src/udev/udevadm-monitor.c @@ -2,21 +2,21 @@ #include "sd-device.h" #include "sd-event.h" +#include "sd-json.h" #include "alloc-util.h" #include "device-monitor-private.h" #include "device-private.h" #include "device-util.h" -#include "format-table.h" #include "format-util.h" #include "hashmap.h" -#include "help-util.h" #include "options.h" #include "set.h" #include "static-destruct.h" #include "string-util.h" #include "time-util.h" #include "udevadm.h" +#include "verbs.h" #include "virt.h" static bool arg_show_property = false; @@ -99,25 +99,6 @@ static int setup_monitor(MonitorNetlinkGroup sender, sd_event *event, sd_device_ return 0; } -static int help(void) { - _cleanup_(table_unrefp) Table *options = NULL; - int r; - - r = option_parser_get_help_table_ns("udevadm-monitor", &options); - if (r < 0) - return r; - - help_cmdline("monitor [OPTIONS]"); - help_abstract("Listen to kernel and udev events."); - 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; @@ -132,7 +113,7 @@ static int parse_argv(int argc, char *argv[]) { OPTION_NAMESPACE("udevadm-monitor"): {} OPTION_COMMON_HELP: - return help(); + return command_print_verb_help("monitor"); OPTION('V', "version", NULL, "Show package version"): return print_version(); @@ -182,6 +163,9 @@ static int parse_argv(int argc, char *argv[]) { if (r < 0) return log_oom(); break; + + OPTION_COMMON_INTROSPECT_CLI: + return introspect_cli(SD_JSON_FORMAT_OFF); } if (!arg_print_kernel && !arg_print_udev) {