resolvectl: convert to VERB_COMMAND
This commit is contained in:
+10
-37
@@ -30,7 +30,6 @@
|
||||
#include "format-ifname.h"
|
||||
#include "format-table.h"
|
||||
#include "glyph-util.h"
|
||||
#include "help-util.h"
|
||||
#include "hostname-util.h"
|
||||
#include "json-util.h"
|
||||
#include "main-func.h"
|
||||
@@ -96,6 +95,14 @@ STATIC_DESTRUCTOR_REGISTER(arg_set_dns, strv_freep);
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_set_domain, strv_freep);
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_set_nta, strv_freep);
|
||||
|
||||
COMMAND(
|
||||
"resolvectl\0systemd-resolve\0",
|
||||
"Send control commands to the network name resolution manager, or\n"
|
||||
"resolve domain names, IPv4 and IPv6 addresses, DNS records, and services.",
|
||||
.man_pages = "resolvectl.1\0",
|
||||
.option_namespace = "resolvectl",
|
||||
);
|
||||
|
||||
typedef enum StatusMode {
|
||||
STATUS_ALL,
|
||||
STATUS_DNS,
|
||||
@@ -3211,41 +3218,7 @@ static void help_dns_classes(void) {
|
||||
DUMP_STRING_TABLE(dns_class, int, _DNS_CLASS_MAX);
|
||||
}
|
||||
|
||||
static int native_help(void) {
|
||||
_cleanup_(table_unrefp) Table *verbs = NULL, *options = NULL;
|
||||
int r;
|
||||
|
||||
r = verbs_get_help_table(&verbs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = option_parser_get_help_table_ns("resolvectl", &options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) table_sync_column_widths(0, verbs, options);
|
||||
|
||||
pager_open(arg_pager_flags);
|
||||
|
||||
help_cmdline("[OPTIONS…] COMMAND …");
|
||||
help_abstract("Send control commands to the network name resolution manager, or\n"
|
||||
"resolve domain names, IPv4 and IPv6 addresses, DNS records, and services.");
|
||||
|
||||
help_section("Commands");
|
||||
r = table_print_or_warn(verbs);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
help_section("Options");
|
||||
r = table_print_or_warn(options);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
help_man_page_reference("resolvectl", "1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
VERB_COMMON_HELP_HIDDEN(native_help);
|
||||
VERB_COMMON_HELP_AUTO_HIDDEN("resolvectl");
|
||||
|
||||
static int compat_parse_argv(int argc, char *argv[], char ***remaining_args) {
|
||||
int r;
|
||||
@@ -3502,7 +3475,7 @@ static int native_parse_argv(int argc, char *argv[], char ***remaining_args) {
|
||||
OPTION_NAMESPACE("resolvectl"): {}
|
||||
|
||||
OPTION_COMMON_HELP:
|
||||
return native_help();
|
||||
return command_print_help("resolvectl");
|
||||
|
||||
OPTION_COMMON_VERSION:
|
||||
return version();
|
||||
|
||||
Reference in New Issue
Block a user