R/hello.R

Defines functions print.new_class hello hello_old

Documented in hello hello_old

#' Title
#'
#' @return Prints "Hello, World!" in green.
#' @export
#'
#' @examples
#' hello_old()
hello_old <- function() {
  cat(crayon::green("Hello, World!"))
}


#' Title
#'
#' @return Prints your message in green.
#'
#' @param msg Input that should be printed in green.
#'
#' @export
#'
#' @examples
#' hello("hello")
hello <- function(msg) {
  structure(msg, class = "new_class")
}

#' @export
print.new_class <- function(x, ...) {
  cat(crayon::green(x))
  invisible(x)
}
TSchiefer/r.pkg documentation built on Feb. 25, 2022, 12:28 p.m.