shared/help-util: automatically append ":" in sections

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-05-05 11:14:33 +02:00
parent 29b00c956f
commit f7434671bd
30 changed files with 42 additions and 46 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ static int help(void) {
help_cmdline("[OPTIONS...]");
help_abstract("Report whether we are connected to an external power source.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+1 -1
View File
@@ -69,7 +69,7 @@ static int help(void) {
help_cmdline("[OPTIONS...] --fork -- CMDLINE...");
help_abstract("Notify the service manager about service status updates.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+2 -6
View File
@@ -166,11 +166,7 @@ static int help(void) {
help_abstract("Run the specified command in a transient scope or service.");
for (size_t i = 0; i < ELEMENTSOF(groups); i++) {
_cleanup_free_ char *title = strjoin(groups[i] ?: "Options", ":");
if (!title)
return log_oom();
help_section(title);
help_section(groups[i] ?: "Options");
r = table_print_or_warn(tables[i]);
if (r < 0)
@@ -196,7 +192,7 @@ static int help_sudo_mode(void) {
help_cmdline("[OPTIONS...] COMMAND [ARGUMENTS...]");
help_abstract("Elevate privileges interactively.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(opts_table);
if (r < 0)
+1 -1
View File
@@ -47,7 +47,7 @@ void help_abstract(const char *text) {
void help_section(const char *title) {
assert(title);
printf("\n%s%s%s\n",
printf("\n%s%s:%s\n",
ansi_underline(),
title,
ansi_normal());
+1 -1
View File
@@ -393,7 +393,7 @@ static int help(void) {
if (r < 0)
return r;
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
+1 -1
View File
@@ -753,7 +753,7 @@ static int help(void) {
if (r < 0)
return r;
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
+2 -2
View File
@@ -65,13 +65,13 @@ static int help(void) {
(void) table_sync_column_widths(0, verbs, options);
help_section("Commands:");
help_section("Commands");
r = table_print_or_warn(verbs);
if (r < 0)
return r;
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
+8 -8
View File
@@ -113,7 +113,7 @@ static int systemctl_help(void) {
help_cmdline("[OPTIONS...] COMMAND ...");
help_abstract("Query or send control commands to the system manager.");
help_section("Unit Commands:");
help_section("Unit Commands");
printf(" list-units [PATTERN...] List units currently in memory\n"
" list-automounts [PATTERN...] List automount units currently in memory,\n"
" ordered by path\n"
@@ -162,7 +162,7 @@ static int systemctl_help(void) {
" whoami [PID...] Return unit caller or specified PIDs are\n"
" part of\n");
help_section("Unit File Commands:");
help_section("Unit File Commands");
printf(" list-unit-files [PATTERN...] List installed unit files\n"
" enable [UNIT...|PATH...] Enable one or more unit files\n"
" disable UNIT... Disable one or more unit files\n"
@@ -186,27 +186,27 @@ static int systemctl_help(void) {
" get-default Get the name of the default target\n"
" set-default TARGET Set the default target\n");
help_section("Machine Commands:");
help_section("Machine Commands");
printf(" list-machines [PATTERN...] List local containers and host\n");
help_section("Job Commands:");
help_section("Job Commands");
printf(" list-jobs [PATTERN...] List jobs\n"
" cancel [JOB...] Cancel all, one, or more jobs\n");
help_section("Environment Commands:");
help_section("Environment Commands");
printf(" show-environment Dump environment\n"
" set-environment VARIABLE=VALUE... Set one or more environment variables\n"
" unset-environment VARIABLE... Unset one or more environment variables\n"
" import-environment VARIABLE... Import all or some environment variables\n");
help_section("Manager State Commands:");
help_section("Manager State Commands");
printf(" daemon-reload Reload systemd manager configuration\n"
" daemon-reexec Reexecute systemd manager\n"
" log-level [LEVEL] Get/set logging threshold for manager\n"
" log-target [TARGET] Get/set logging target for manager\n"
" service-watchdogs [BOOL] Get/set service watchdog state\n");
help_section("System Commands:");
help_section("System Commands");
printf(" is-system-running Check whether system is fully running\n"
" default Enter system default mode\n"
" rescue Enter system rescue mode\n"
@@ -226,7 +226,7 @@ static int systemctl_help(void) {
" suspend-then-hibernate Suspend the system, wake after a period of\n"
" time, and hibernate\n");
help_section("Options:");
help_section("Options");
printf(" -h --help Show this help\n"
" --version Show package version\n"
" --system Connect to system manager\n"
+1 -1
View File
@@ -368,7 +368,7 @@ static int help(void) {
return r;
help_cmdline("[OPTIONS...] DEVICE");
help_section("Options:");
help_section("Options");
return table_print_or_warn(options);
}
+1 -1
View File
@@ -909,7 +909,7 @@ static int help(void) {
return r;
help_cmdline("[OPTIONS...] DEVICE");
help_section("Options:");
help_section("Options");
return table_print_or_warn(options);
}
+1 -1
View File
@@ -653,7 +653,7 @@ static int help(void) {
return r;
help_cmdline("[OPTIONS...]");
help_section("Options:");
help_section("Options");
return table_print_or_warn(options);
}
+1 -1
View File
@@ -38,7 +38,7 @@ static int help(void) {
help_cmdline("[OPTIONS...] SYSFS_PATH");
help_abstract("Identify FIDO security tokens.");
help_section("Options:");
help_section("Options");
return table_print_or_warn(options);
}
+2 -2
View File
@@ -68,12 +68,12 @@ static int help(void) {
help_cmdline("[OPTIONS...] COMMAND");
help_abstract("Set up iocost model and qos solutions for block devices.");
help_section("Commands:");
help_section("Commands");
r = table_print_or_warn(verbs);
if (r < 0)
return r;
help_section("Options:");
help_section("Options");
return table_print_or_warn(options);
}
+1 -1
View File
@@ -45,7 +45,7 @@ static int help(void) {
help_cmdline("[OPTIONS...] /dev/mtd[n]");
help_abstract("Probe MTD devices.");
help_section("Options:");
help_section("Options");
return table_print_or_warn(options);
}
+1 -1
View File
@@ -216,7 +216,7 @@ static int help(void) {
help_cmdline("[OPTION...] DEVICE");
help_abstract("SCSI device identification.");
help_section("Options:");
help_section("Options");
return table_print_or_warn(options);
}
+1 -1
View File
@@ -160,7 +160,7 @@ static int help(void) {
help_cmdline("[OPTIONS...]");
help_abstract("Rule-based manager for device events and files.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
+1 -1
View File
@@ -28,7 +28,7 @@ static int help(void) {
help_cmdline("cat [OPTIONS...] [FILE...]");
help_abstract("Show udev rules files.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+1 -1
View File
@@ -57,7 +57,7 @@ static int help(void) {
help_cmdline("control OPTION");
help_abstract("Control the udev daemon.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+1 -1
View File
@@ -25,7 +25,7 @@ static int help(void) {
help_cmdline("hwdb [OPTIONS]");
help_abstract("Update or query the hardware database.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+1 -1
View File
@@ -811,7 +811,7 @@ static int help(void) {
help_cmdline("info [OPTIONS] [DEVPATH|FILE]");
help_abstract("Query sysfs or the udev database.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+1 -1
View File
@@ -45,7 +45,7 @@ static int help(void) {
help_cmdline("lock [OPTIONS...] COMMAND");
help_cmdline("lock [OPTIONS...] --print");
help_abstract("Lock a block device and run a command.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+1 -1
View File
@@ -109,7 +109,7 @@ static int help(void) {
help_cmdline("monitor [OPTIONS]");
help_abstract("Listen to kernel and udev events.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+1 -1
View File
@@ -39,7 +39,7 @@ static int help(void) {
help_cmdline("settle [OPTIONS]");
help_abstract("Wait for pending udev events.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+2 -2
View File
@@ -24,12 +24,12 @@ static int help(void) {
help_cmdline("test-builtin [OPTIONS] COMMAND DEVPATH");
help_abstract("Test a built-in command.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
help_section("Commands:");
help_section("Commands");
udev_builtin_list();
return 0;
}
+1 -1
View File
@@ -44,7 +44,7 @@ static int help(void) {
help_cmdline("test [OPTIONS] DEVPATH");
help_abstract("Test an event run.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+1 -1
View File
@@ -331,7 +331,7 @@ static int help(void) {
help_cmdline("trigger [OPTIONS] DEVPATH");
help_abstract("Request events from the kernel.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+1 -1
View File
@@ -33,7 +33,7 @@ static int help(void) {
help_cmdline("verify [OPTIONS] [FILE...]");
help_abstract("Verify udev rules files.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+1 -1
View File
@@ -307,7 +307,7 @@ static int help(void) {
help_cmdline("wait [OPTIONS] DEVICE [DEVICE…]");
help_abstract("Wait for devices or device symlinks being created.");
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+2 -2
View File
@@ -30,12 +30,12 @@ static int help(void) {
help_cmdline("[OPTIONS…] COMMAND [COMMAND OPTIONS…]");
help_abstract("Send control commands or test the device manager.");
help_section("Commands:");
help_section("Commands");
r = table_print_or_warn(verbs);
if (r < 0)
return r;
help_section("Options:");
help_section("Options");
r = table_print_or_warn(options);
if (r < 0)
return r;
+1 -1
View File
@@ -32,7 +32,7 @@ static int help(void) {
help_cmdline("[OPTIONS...] DEVICE");
help_abstract("Video4Linux device identification.");
help_section("Options:");
help_section("Options");
return table_print_or_warn(options);
}