udevadm-settle: 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-settle" option namespace.
This commit is contained in:
@@ -8,13 +8,12 @@
|
||||
|
||||
#include "sd-bus.h"
|
||||
#include "sd-event.h"
|
||||
#include "sd-json.h"
|
||||
#include "sd-login.h"
|
||||
#include "sd-messages.h"
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "bus-util.h"
|
||||
#include "format-table.h"
|
||||
#include "help-util.h"
|
||||
#include "options.h"
|
||||
#include "path-util.h"
|
||||
#include "string-util.h"
|
||||
@@ -24,30 +23,12 @@
|
||||
#include "udevadm.h"
|
||||
#include "udevadm-util.h"
|
||||
#include "unit-def.h"
|
||||
#include "verbs.h"
|
||||
#include "virt.h"
|
||||
|
||||
static usec_t arg_timeout_usec = 120 * USEC_PER_SEC;
|
||||
static const char *arg_exists = NULL;
|
||||
|
||||
static int help(void) {
|
||||
_cleanup_(table_unrefp) Table *options = NULL;
|
||||
int r;
|
||||
|
||||
r = option_parser_get_help_table_ns("udevadm-settle", &options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
help_cmdline("settle [OPTIONS]");
|
||||
help_abstract("Wait for pending 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;
|
||||
|
||||
@@ -62,7 +43,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
OPTION_NAMESPACE("udevadm-settle"): {}
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return help();
|
||||
return command_print_verb_help("settle");
|
||||
|
||||
OPTION('V', "version", NULL, "Show package version"):
|
||||
return print_version();
|
||||
@@ -86,6 +67,9 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
return log_info_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Option -%c no longer supported.",
|
||||
opts.opt->short_code);
|
||||
|
||||
OPTION_COMMON_INTROSPECT_CLI:
|
||||
return introspect_cli(SD_JSON_FORMAT_OFF);
|
||||
}
|
||||
|
||||
if (option_parser_get_n_args(&opts) > 0)
|
||||
|
||||
Reference in New Issue
Block a user