% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/package-extra.R
\name{setPackageExtraHandler}
\alias{setPackageExtraHandler}
\alias{packageExtraHandler}
\alias{setPackageExtra}
\alias{packageExtra}
\alias{packageExtraRunner}
\alias{install.extras}
\alias{install.extrapackages}
\title{Install/Run Extra Things After Standard Package Installation}
\usage{
setPackageExtraHandler(handler, fun, ...)

packageExtraHandler(handler = NULL, ...)

setPackageExtra(handler, extra, ...)

packageExtra(handler = NULL, extra = NULL, package = NULL, .wrap = FALSE)

packageExtraRunner(handler)

install.extras(
  package,
  extra = NULL,
  handler = NULL,
  ...,
  .verbose = getOption("verbose")
)

install.extrapackages(
  package,
  extra = NULL,
  handler = NULL,
  ...,
  .verbose = getOption("verbose")
)
}
\arguments{
\item{handler}{name of a handler, e.g, \code{'install'}.
It must be unique across all handlers registered by any other packages.}

\item{fun}{handler function that will be called with the arguments registered
with \code{packageExtra(name, ...)}}

\item{...}{extra arguments passed to internal function calls.
In \code{packageExtraHandler}, these are passed to \code{\link{pkgreg_fetch}}.

In \code{setPackageExtra}, these define default arguments for the handler function.
These are overwritten by arguments in the call to runner function if any.}

\item{extra}{name of the extra action.}

\item{package}{package name where to store/look for the internal registries.
End users should not need to use this argument.}

\item{.wrap}{logical that indicates if a function that runs the extra action should
be returned or only the default arguments}

\item{.verbose}{logical that indicates if verbose messages about the extra actions being
run should be displayed.}
}
\value{
the runner function associated with the newly registered handler,
as built by \code{packageExtraRunner}.
}
\description{
These functions define a framework to register actions for which default sets of arguments
can be defined when (lazy-)loading a package, and run later on, e.g., after the package
is installed using dedicated commands.

\code{setPackageExtraHandler} defines main action handler functions, for which
actions are defined as a set of arguments and registered using \code{setPackageExtra}.
}
\section{Functions}{
\itemize{
\item \code{packageExtraHandler()}: retrieves a given handler from the registry.

\item \code{setPackageExtra()}: registers extra actions for a given handler.

For example, calling \code{setPackageExtra('install', pkgs='non_CRAN_pkg', repos='http://non-standard-repo')}
in a source file of package 'myPkg' registers the call
\code{install.packages('non_CRAN_pkg', repos='http://non-standard-repo', ...)}
in a registry internal to the package.
All calls to \code{setPackageExtra('install', ...)} can then be run by the user, as
a post installation step via \code{install.extrapackages('myPkg', ..)}.

\item \code{packageExtra()}: retrieve a given extra action, either as its registry entry,
or as a function that would perform the given action.

\item \code{packageExtraRunner()}: defines a function to run all or some of the actions registered
for a given handler in a given package.
For example, the function \code{install.extrapackages} is the runner defined for the extra handler \code{'install'}
via \code{packageExtraRunner('install')}.

\item \code{install.extras()}: runs all extra actions registered for a given package.

\item \code{install.extrapackages()}: install sets of packages that can enhance a
package, but may not be available from CRAN.

It is defined as the extra handler for
the extra action handler \code{'install.packages'}.
All arguments in \code{...} are passed to \code{\link{install.packages}}.
By default, packages that are already installed are not re-installed.
An extra argument \code{force} allows to force their installation.
The packages are loaded if their installation is successful.

}}
