diff --git a/R/scriptSkeleton.R b/R/scriptSkeleton.R index 3222762..d57e6f5 100644 --- a/R/scriptSkeleton.R +++ b/R/scriptSkeleton.R @@ -1,6 +1,6 @@ #' Generate a Rscript with its skeleton #' -#' @param file Output file. By default the function writes to standard output. +#' @param file Output file. Use `file=stdout()` to write the output to standard output. #' #' @return Invisibly returns the character vector of skeleton lines. #' Called for its side effect of writing to \code{file}. @@ -8,7 +8,7 @@ #' @examples #' scriptSkeleton(file = file.path(tempdir(), "myscript.R")) -scriptSkeleton <- function(file=stdout()) { +scriptSkeleton <- function(file) { sentences <- c("#!/usr/bin/env Rscript", "", "# Initialize the script", @@ -34,6 +34,8 @@ scriptSkeleton <- function(file=stdout()) { "doLog(\"%s quits\", scriptName())", "qqmsg(status=0L)", sep="\n") - writeLines(text=sentences, con=file, sep="\n") + if(!missing(file)) { + writeLines(text=sentences, con=file, sep="\n") + } return(invisible(sentences)) } diff --git a/man/ribiosArg-package.Rd b/man/ribiosArg-package.Rd index 238c014..2dfddd4 100644 --- a/man/ribiosArg-package.Rd +++ b/man/ribiosArg-package.Rd @@ -18,5 +18,10 @@ Useful links: \author{ \strong{Maintainer}: Jitao David Zhang \email{jitao_david.zhang@roche.com} (\href{https://orcid.org/0000-0002-3085-0909}{ORCID}) [contributor] +Other contributors: +\itemize{ + \item Balazs Banfai [contributor] +} + } \keyword{internal} diff --git a/man/scriptSkeleton.Rd b/man/scriptSkeleton.Rd index 382457b..b4fd735 100644 --- a/man/scriptSkeleton.Rd +++ b/man/scriptSkeleton.Rd @@ -4,10 +4,10 @@ \alias{scriptSkeleton} \title{Generate a Rscript with its skeleton} \usage{ -scriptSkeleton(file = stdout()) +scriptSkeleton(file) } \arguments{ -\item{file}{Output file. By default the function writes to standard output.} +\item{file}{Output file. Use `file=stdout()` to write the output to standard output.} } \value{ Invisibly returns the character vector of skeleton lines.