R/formatted.R

Defines functions pak_preformat print.pak_preformatted format.pak_preformatted

#' @export

format.pak_preformatted <- function(x, ...) {
  attr(x, "pak_preformatted")
}

#' @export

print.pak_preformatted <- function(x, ...) {
  cat(format(x, ...), sep = "\n")
}

pak_preformat <- function(x, ...) {
  attr(x, "pak_preformatted") <- format(x, ...)
  class(x) <- c("pak_preformatted", class(x))
  x
}
r-lib/pkgman documentation built on Nov. 18, 2024, 2:23 p.m.