Skip to content

Commit

Permalink
Improve pkg_sysreqs() output
Browse files Browse the repository at this point in the history
So it can be copy-pasted into a shell.
  • Loading branch information
gaborcsardi committed Jul 17, 2023
1 parent d291732 commit 3768f53
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion R/sysreqs.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit 3768f53

Please sign in to comment.