From 3768f53541de5957a7dd17a800f4a38cbc7b80c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Mon, 17 Jul 2023 14:20:29 +0200 Subject: [PATCH] Improve pkg_sysreqs() output So it can be copy-pasted into a shell. --- R/sysreqs.R | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/R/sysreqs.R b/R/sysreqs.R index 4bf3380cd..51de51d77 100644 --- a/R/sysreqs.R +++ b/R/sysreqs.R @@ -161,10 +161,18 @@ format.pak_sysreqs <- function(x, ...) { } } + sh_wrap <- function(x) { + out <- cli$ansi_strwrap(x, exdent = 2, width = cli$console_width() - 2) + if (length(out) > 1) { + out[-length(out)] <- paste0(out[-length(out)], " \\") + } + out + } + c( cli$rule(left = "Install scripts", right = label), x$pre_install, - cli$ansi_strwrap(x$install_scripts, exdent = 2), + sh_wrap(x$install_scripts), x$post_install, "", cli$rule(left = "Packages and their system dependencies"),