From 7ea090f41b389cb9448b4f1f81fe866a3cd27cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 13 Aug 2026 13:22:24 +0200 Subject: [PATCH] verbs: wrap the help footer at print time The footer is now wrapped to min($COLUMNS, 80) when it is printed, so CommandDescription footers do not need to be hard-wrapped in the source, and make use of the available terminal width. Newlines embedded in the text are preserved and each line is wrapped independently, so explicit line breaks can still be used where needed, e.g. before the example command line in varlinkctl. The text is wrapped at max of 80 columns to avoid very wrong lines on wide terminals. Such lines are hard to read. A new helper is added for this. We already have format_strv_width in format-table, but it requires a strv, so we'd need to conver the data, and returns a formatted string, which we'd need to print ourselves. So overall, it seems better to add a dedicated helper. --- src/resolve/resolvconf-compat.c | 12 +++++------ src/shared/verbs.c | 37 +++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/resolve/resolvconf-compat.c b/src/resolve/resolvconf-compat.c index 51e226da84..8e4835b4f8 100644 --- a/src/resolve/resolvconf-compat.c +++ b/src/resolve/resolvconf-compat.c @@ -28,12 +28,12 @@ COMMAND( .argspec = "-a INTERFACE footer) - printf("\n%s\n", cmd->footer); + r = print_wrapped(cmd->footer); + if (r < 0) + return r; r = print_man_links(cmd->man_pages); if (r < 0)