report-cgroup: convert to VERB_COMMAND and add --introspect-cli

The custom help() is replaced by a COMMAND() description, and
--introspect-cli is added. The referenced systemd-report-cgroup(8) man
page does not exist, so the reference is dropped.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-08-19 08:21:29 +02:00
parent 45966bcf8e
commit 8f42146976
2 changed files with 12 additions and 24 deletions
+11 -24
View File
@@ -1,16 +1,20 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-json.h"
#include "sd-varlink.h"
#include "build.h"
#include "format-table.h"
#include "help-util.h"
#include "log.h"
#include "main-func.h"
#include "options.h"
#include "report-cgroup.h"
#include "varlink-io.systemd.Metrics.h"
#include "varlink-util.h"
#include "verbs.h"
COMMAND(
"systemd-report-cgroup\0",
"Report cgroup metrics.",
);
static int vl_server(void) {
_cleanup_(sd_varlink_server_unrefp) sd_varlink_server *vs = NULL;
@@ -38,26 +42,6 @@ static int vl_server(void) {
return 0;
}
static int help(void) {
_cleanup_(table_unrefp) Table *options = NULL;
int r;
r = option_parser_get_help_table(&options);
if (r < 0)
return r;
help_cmdline("[OPTIONS...]");
help_abstract("Report cgroup metrics.");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
help_man_page_reference("systemd-report-cgroup", "8");
return 0;
}
static int parse_argv(int argc, char *argv[]) {
int r;
@@ -70,10 +54,13 @@ static int parse_argv(int argc, char *argv[]) {
switch (c) {
OPTION_COMMON_HELP:
return help();
return command_print_help("systemd-report-cgroup");
OPTION_COMMON_VERSION:
return version();
OPTION_COMMON_INTROSPECT_CLI:
return introspect_cli(SD_JSON_FORMAT_OFF);
}
if (option_parser_get_n_args(&opts) > 0)
@@ -89,6 +89,7 @@ INTROSPECTABLE=(
systemd-repart
systemd-report
systemd-report-basic
systemd-report-cgroup
systemd-run
systemd-sbsign
systemd-sleep