Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions R/scriptSkeleton.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#' 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}.
#' @export
#' @examples
#' scriptSkeleton(file = file.path(tempdir(), "myscript.R"))

scriptSkeleton <- function(file=stdout()) {
scriptSkeleton <- function(file) {
sentences <- c("#!/usr/bin/env Rscript",
"",
"# Initialize the script",
Expand All @@ -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))
}
5 changes: 5 additions & 0 deletions man/ribiosArg-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/scriptSkeleton.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.