]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/options: fix display of OPTION_HELP_ENTRY_VERBATIM
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Fri, 15 May 2026 15:51:41 +0000 (17:51 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Fri, 15 May 2026 16:47:17 +0000 (18:47 +0200)
So far it was used only once, in bootctl. It should not be indented:
  -R --print-root-device
  -RR
  ^

src/shared/options.c

index ac36fe07653ec16d046b6f6e3282b2a5ae684467..1a24106fc5403476ee12128a626a9d56581668d7 100644 (file)
@@ -510,7 +510,8 @@ int _option_parser_get_help_table_full(
                 /* We indent the option string by two spaces. We could set the minimum cell width and
                  * right-align for a similar result, but that'd be more work. This is only used for
                  * display. */
-                const char *prefix = opt->short_code != 0 ? "  " : "     ";
+                bool shift_left = opt->short_code != 0 || FLAGS_SET(opt->flags, OPTION_HELP_ENTRY_VERBATIM);
+                const char *prefix = shift_left ? "  " : "     ";
                 _cleanup_free_ char *t = strjoin(prefix, s);
                 if (!t)
                         return log_oom();