diff --git a/R/font.r b/R/font.r index c23325c..c2128dd 100644 --- a/R/font.r +++ b/R/font.r @@ -4,16 +4,20 @@ #' #' @param paths A vector of directories to search in. (Default is to auto-detect based on OS) #' @param recursive Search recursively in directories? (Default TRUE) -#' @param prompt Show confirmation prompt? (Default TRUE) +#' @param prompt Show confirmation prompt? (Default TRUE for interactive sessions) #' @param pattern A regular expression that the filenames must match. #' #' @examples #' font_import() #' #' @export -font_import <- function(paths = NULL, recursive = TRUE, prompt = TRUE, +font_import <- function(paths = NULL, recursive = TRUE, prompt = NULL, pattern = NULL) { + if (is.null(prompt)) { + prompt <- interactive() + } + if (prompt) { resp <- readline("Importing fonts may take a few minutes, depending on the number of fonts and the speed of the system.\nContinue? [y/n] ") if (tolower(resp) != "y") { diff --git a/man/font_import.Rd b/man/font_import.Rd index cddc484..5be2551 100644 --- a/man/font_import.Rd +++ b/man/font_import.Rd @@ -4,15 +4,14 @@ \alias{font_import} \title{Import system fonts} \usage{ -font_import(paths = NULL, recursive = TRUE, prompt = TRUE, - pattern = NULL) +font_import(paths = NULL, recursive = TRUE, prompt = NULL, pattern = NULL) } \arguments{ \item{paths}{A vector of directories to search in. (Default is to auto-detect based on OS)} \item{recursive}{Search recursively in directories? (Default TRUE)} -\item{prompt}{Show confirmation prompt? (Default TRUE)} +\item{prompt}{Show confirmation prompt? (Default TRUE for interactive sessions)} \item{pattern}{A regular expression that the filenames must match.} }