.argspec = "-a INTERFACE <FILE\0"
"-d INTERFACE\0",
.footer =
- "This is a compatibility alias for the resolvectl(1) tool, providing native\n"
- "command line compatibility with the resolvconf(8) tool of various Linux\n"
- "distributions and BSD systems. Some options supported by other implementations\n"
- "are not supported and are ignored: -m, -u. Various options supported by other\n"
- "implementations are not supported and will cause the invocation to fail:\n"
- "-I, -i, -l, -R, -r, -v, -V, --enable-updates, --disable-updates,\n"
+ "This is a compatibility alias for the resolvectl(1) tool, providing native "
+ "command line compatibility with the resolvconf(8) tool of various Linux "
+ "distributions and BSD systems. Some options supported by other implementations "
+ "are not supported and are ignored: -m, -u. Various options supported by other "
+ "implementations are not supported and will cause the invocation to fail: "
+ "-I, -i, -l, -R, -r, -v, -V, --enable-updates, --disable-updates, "
"--updates-are-enabled.",
.option_namespace = "resolvconf",
);
#include "build.h"
#include "env-util.h"
+#include "extract-word.h"
#include "format-table.h"
#include "help-util.h"
#include "log.h"
return false;
}
+static int print_wrapped(const char *text) {
+
+ /* Print the text wrapped at spaces to the specified width. Newlines embedded in the text
+ * are preserved and each line is wrapped independently, so explicit line breaks (e.g.
+ * before an example command line) can be used where needed. */
+
+ if (!text)
+ return 0;
+
+ _cleanup_strv_free_ char **lines = NULL, **lines2 = NULL;
+ int r;
+
+ size_t width = MIN(columns(), 80U); /* This is a reasonable default. */
+
+ r = strv_split_full(&lines, text, "\n", EXTRACT_DONT_COALESCE_SEPARATORS);
+ if (r < 0)
+ return r;
+
+ r = strv_rebreak_lines(lines, width, &lines2);
+ if (r < 0)
+ return r;
+
+ /* Seperate this block from the previous input. */
+ putchar('\n');
+
+ STRV_FOREACH(line, lines2)
+ puts(*line);
+
+ return 0;
+}
+
int _command_print_help(
const Verb verbs[],
const Verb verbs_end[],
if (r < 0)
return log_error_errno(r, "Failed to print verb&option help: %m");
- if (cmd->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)