% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/webr-repl-directory-links.R
\name{webr_repl_directory}
\alias{webr_repl_directory}
\title{Create webR REPL sharelinks from a directory of R files}
\usage{
webr_repl_directory(
  directory_path,
  autorun = FALSE,
  single_link = FALSE,
  pattern = "\\\\.R$",
  base_path = "/home/web_user/",
  panels = NULL,
  version = "latest",
  base_url = NULL
)
}
\arguments{
\item{directory_path}{Character string specifying the path to the directory containing R files}

\item{autorun}{Logical. Whether to enable autorun for all generated links (default: FALSE).
With \code{single_link = TRUE}, this runs every R file in the bundle on arrival.}

\item{single_link}{Logical. If \code{FALSE} (default), each matched file becomes its
own link and the result is a \code{webr_directory}. If \code{TRUE}, all matched files
are packed into one link and the result is a single \code{webr_project}.}

\item{pattern}{Regular expression matched against file names in
\code{directory_path}. Defaults to \code{"\\\\.R$"}, i.e. files ending in \code{.R}.}

\item{base_path}{Base directory path for files in webR (default: "/home/web_user/")}

\item{panels}{Character vector or string specifying which webR interface panels to show.
Valid panels: "plot", "files", "terminal", "editor". Can be c("plot", "files") or "plot-files".
If NULL (default), shows all panels.}

\item{version}{webR version to use ("latest" or specific version >= "v0.5.4")}

\item{base_url}{webR application URL. If NULL, uses global option or builds from version}
}
\value{
By default a \code{webr_directory} object, whose \code{urls} element is a named character
vector mapping each filename to its webR sharelink. With \code{single_link = TRUE}, a
single \code{webr_project} object bundling every matched file into one link.
}
\description{
Batch processes all R files in a directory. By default each file becomes its
own webR sharelink; with \code{single_link = TRUE} the whole directory is bundled
into one link instead, exactly as \code{\link[=webr_repl_project]{webr_repl_project()}} would. Useful for
converting collections of scripts, examples, or course materials.
}
\examples{
# A directory of R scripts
examples <- tempfile()
dir.create(examples)
writeLines("plot(1:10)", file.path(examples, "plot.R"))
writeLines("hist(rnorm(100))", file.path(examples, "hist.R"))

links <- webr_repl_directory(examples, autorun = TRUE)
print(links)

# Bundle the whole directory into one link instead
webr_repl_directory(examples, single_link = TRUE, panels = c("editor", "plot"))

# Show only the editor and terminal panels
webr_repl_directory(examples, panels = c("editor", "terminal"))

# Match a subset of files
webr_repl_directory(examples, pattern = "^plot")

# The URLs, named by file
repl_urls(links)

}
\seealso{
\code{\link[=webr_repl_project]{webr_repl_project()}}, which bundles a named list or a vector of file
paths into one link.
}
