From: Zbigniew Jędrzejewski-Szmek Date: Tue, 5 May 2026 08:40:31 +0000 (+0200) Subject: shared/help-util: automatically append ":" in sections X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f7434671bda922781e8bc3ddaf108a7e2127bfc6;p=thirdparty%2Fsystemd.git shared/help-util: automatically append ":" in sections --- diff --git a/src/ac-power/ac-power.c b/src/ac-power/ac-power.c index 2a9c5173293..87242a3b08c 100644 --- a/src/ac-power/ac-power.c +++ b/src/ac-power/ac-power.c @@ -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; diff --git a/src/notify/notify.c b/src/notify/notify.c index 6c50e4c57c3..0058eb9d3b9 100644 --- a/src/notify/notify.c +++ b/src/notify/notify.c @@ -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; diff --git a/src/run/run.c b/src/run/run.c index 46b8014e580..afae5b2d94a 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -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) diff --git a/src/shared/help-util.c b/src/shared/help-util.c index 7e9d3e70be0..7b67bb58f1a 100644 --- a/src/shared/help-util.c +++ b/src/shared/help-util.c @@ -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()); diff --git a/src/storage/storage-block.c b/src/storage/storage-block.c index e5454a29c28..b33bf9ce40b 100644 --- a/src/storage/storage-block.c +++ b/src/storage/storage-block.c @@ -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) diff --git a/src/storage/storage-fs.c b/src/storage/storage-fs.c index c01e91a4cef..167b10dd835 100644 --- a/src/storage/storage-fs.c +++ b/src/storage/storage-fs.c @@ -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) diff --git a/src/storage/storagectl.c b/src/storage/storagectl.c index 2bc7b7c2a3e..f88dff29bc8 100644 --- a/src/storage/storagectl.c +++ b/src/storage/storagectl.c @@ -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) diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 4f76c515002..775188b5191 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -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" diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c index c2fabdcdb84..1cde89ad6f6 100644 --- a/src/udev/ata_id/ata_id.c +++ b/src/udev/ata_id/ata_id.c @@ -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); } diff --git a/src/udev/cdrom_id/cdrom_id.c b/src/udev/cdrom_id/cdrom_id.c index 27423e98515..40fd7a1e77d 100644 --- a/src/udev/cdrom_id/cdrom_id.c +++ b/src/udev/cdrom_id/cdrom_id.c @@ -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); } diff --git a/src/udev/dmi_memory_id/dmi_memory_id.c b/src/udev/dmi_memory_id/dmi_memory_id.c index a1708c128c9..64af7b80287 100644 --- a/src/udev/dmi_memory_id/dmi_memory_id.c +++ b/src/udev/dmi_memory_id/dmi_memory_id.c @@ -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); } diff --git a/src/udev/fido_id/fido_id.c b/src/udev/fido_id/fido_id.c index a19c7eebec6..30bc96c526b 100644 --- a/src/udev/fido_id/fido_id.c +++ b/src/udev/fido_id/fido_id.c @@ -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); } diff --git a/src/udev/iocost/iocost.c b/src/udev/iocost/iocost.c index eadab1cb8a0..1efd4a5365e 100644 --- a/src/udev/iocost/iocost.c +++ b/src/udev/iocost/iocost.c @@ -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); } diff --git a/src/udev/mtd_probe/mtd_probe.c b/src/udev/mtd_probe/mtd_probe.c index fe9924f1b6e..7280573646d 100644 --- a/src/udev/mtd_probe/mtd_probe.c +++ b/src/udev/mtd_probe/mtd_probe.c @@ -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); } diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c index d7970722848..295819351d1 100644 --- a/src/udev/scsi_id/scsi_id.c +++ b/src/udev/scsi_id/scsi_id.c @@ -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); } diff --git a/src/udev/udev-config.c b/src/udev/udev-config.c index 541ba16dd90..27a72f2ac8d 100644 --- a/src/udev/udev-config.c +++ b/src/udev/udev-config.c @@ -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) diff --git a/src/udev/udevadm-cat.c b/src/udev/udevadm-cat.c index 62d30d0234d..fcce76663e1 100644 --- a/src/udev/udevadm-cat.c +++ b/src/udev/udevadm-cat.c @@ -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; diff --git a/src/udev/udevadm-control.c b/src/udev/udevadm-control.c index a6ffe83ceca..0a0bb35fb5d 100644 --- a/src/udev/udevadm-control.c +++ b/src/udev/udevadm-control.c @@ -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; diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index b029db2262a..bb6f03d5408 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -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; diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c index a5cbedc8dee..73ed70f4bff 100644 --- a/src/udev/udevadm-info.c +++ b/src/udev/udevadm-info.c @@ -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; diff --git a/src/udev/udevadm-lock.c b/src/udev/udevadm-lock.c index c1c3211d349..fd4b6a9059a 100644 --- a/src/udev/udevadm-lock.c +++ b/src/udev/udevadm-lock.c @@ -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; diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c index c7d1f40fc49..76c9d16d1f9 100644 --- a/src/udev/udevadm-monitor.c +++ b/src/udev/udevadm-monitor.c @@ -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; diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c index 211a8ff1fbf..77882cc074a 100644 --- a/src/udev/udevadm-settle.c +++ b/src/udev/udevadm-settle.c @@ -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; diff --git a/src/udev/udevadm-test-builtin.c b/src/udev/udevadm-test-builtin.c index 9c0082800f3..3de1366b59f 100644 --- a/src/udev/udevadm-test-builtin.c +++ b/src/udev/udevadm-test-builtin.c @@ -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; } diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c index ac368e0f00e..ba8217c8d36 100644 --- a/src/udev/udevadm-test.c +++ b/src/udev/udevadm-test.c @@ -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; diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c index 583d85be0b8..e1fdf323cbc 100644 --- a/src/udev/udevadm-trigger.c +++ b/src/udev/udevadm-trigger.c @@ -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; diff --git a/src/udev/udevadm-verify.c b/src/udev/udevadm-verify.c index f4388f843ad..e7f803dfb1e 100644 --- a/src/udev/udevadm-verify.c +++ b/src/udev/udevadm-verify.c @@ -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; diff --git a/src/udev/udevadm-wait.c b/src/udev/udevadm-wait.c index 60174014406..fa12e6c98c1 100644 --- a/src/udev/udevadm-wait.c +++ b/src/udev/udevadm-wait.c @@ -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; diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c index 47d4335baec..cdc10802749 100644 --- a/src/udev/udevadm.c +++ b/src/udev/udevadm.c @@ -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; diff --git a/src/udev/v4l_id/v4l_id.c b/src/udev/v4l_id/v4l_id.c index 1a53e1092fb..f1f40324de7 100644 --- a/src/udev/v4l_id/v4l_id.c +++ b/src/udev/v4l_id/v4l_id.c @@ -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); }