From 37e35682367ecc7415f8e1ae6f15450445d45496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 24 Jul 2026 20:15:25 +0200 Subject: [PATCH] systemd-ac-power: convert to VERB_COMMAND --- src/ac-power/ac-power.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/src/ac-power/ac-power.c b/src/ac-power/ac-power.c index 87242a3b08..f94908873b 100644 --- a/src/ac-power/ac-power.c +++ b/src/ac-power/ac-power.c @@ -1,13 +1,13 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include "sd-json.h" + #include "battery-util.h" #include "build.h" -#include "format-table.h" -#include "help-util.h" #include "log.h" #include "main-func.h" -#include "options.h" #include "string-util.h" +#include "verbs.h" static bool arg_verbose = false; @@ -16,25 +16,11 @@ static enum { ACTION_LOW, } arg_action = ACTION_AC_POWER; -static int help(void) { - int r; - - _cleanup_(table_unrefp) Table *options = NULL; - r = option_parser_get_help_table(&options); - if (r < 0) - return r; - - help_cmdline("[OPTIONS...]"); - help_abstract("Report whether we are connected to an external power source."); - - help_section("Options"); - r = table_print_or_warn(options); - if (r < 0) - return r; - - help_man_page_reference("systemd-ac-power", "1"); - return 0; -} +COMMAND( + "systemd-ac-power\0", + "Report whether we are connected to an external power source.", + .man_pages = "systemd-ac-power.1\0", +); static int parse_argv(int argc, char *argv[]) { @@ -46,7 +32,7 @@ static int parse_argv(int argc, char *argv[]) { FOREACH_OPTION_OR_RETURN(c, &opts) switch (c) { OPTION_COMMON_HELP: - return help(); + return command_print_help("systemd-ac-power"); OPTION_COMMON_VERSION: return version();