systemd-backlight: convert to VERB_COMMAND

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-08-13 13:23:05 +02:00
parent c9cd66ee3a
commit a60c999d5b
+9 -23
View File
@@ -4,6 +4,7 @@
#include <unistd.h>
#include "sd-device.h"
#include "sd-json.h"
#include "alloc-util.h"
#include "build.h"
@@ -11,8 +12,6 @@
#include "device-util.h"
#include "escape.h"
#include "fileio.h"
#include "format-table.h"
#include "help-util.h"
#include "main-func.h"
#include "parse-util.h"
#include "percent-util.h"
@@ -23,25 +22,12 @@
#define PCI_CLASS_GRAPHICS_CARD 0x30000
static int help(void) {
_cleanup_(table_unrefp) Table *verbs = NULL;
int r;
r = verbs_get_help_table(&verbs);
if (r < 0)
return r;
help_cmdline("COMMAND [backlight|leds]:DEVICE");
help_abstract("Save and restore backlight brightness at shutdown and boot.");
help_section("Commands");
r = table_print_or_warn(verbs);
if (r < 0)
return r;
help_man_page_reference("systemd-backlight", "8");
return 0;
}
COMMAND(
"systemd-backlight\0",
"Save and restore backlight brightness at shutdown and boot.",
.argspec = "COMMAND [backlight|leds]:DEVICE\0",
.man_pages = "systemd-backlight.8\0",
);
static int has_multiple_graphics_cards(void) {
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
@@ -639,7 +625,7 @@ static int verb_save(int argc, char *argv[], uintptr_t _data, void *userdata) {
return 0;
}
VERB_COMMON_HELP_HIDDEN(help);
VERB_COMMON_HELP_AUTO_HIDDEN("systemd-backlight");
static int parse_argv(int argc, char *argv[], char ***ret_args) {
assert(argc >= 0);
@@ -652,7 +638,7 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
switch (c) {
OPTION_COMMON_HELP:
return help();
return command_print_help("systemd-backlight");
OPTION_COMMON_VERSION:
return version();