Debian Codegraph @

man/lockfile-api.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/lockfile-api.R
3 \name{lockfile-api}
4 \alias{lockfile-api}
5 \alias{lockfile}
6 \title{Programmatically Create and Modify a Lockfile}
7 \usage{
8 lockfile(file = NULL, project = NULL)
9 }
10 \arguments{
11 \item{file}{The path to an existing lockfile. When no lockfile is provided,
12 a new one will be created based on the current project context. If you
13 want to create a blank lockfile, use \code{file = NA} instead.}
14
15 \item{project}{The project directory. If \code{NULL}, then the active project will
16 be used. If no project is currently active, then the current working
17 directory is used instead.}
18 }
19 \description{
20 \strong{NOTE: \code{lockfile()} is now internal, please use the \link{lockfiles}
21 API.}
22 }
23 \details{
24 This function provides an API for creating and modifying \code{renv} lockfiles.
25 This can be useful when you'd like to programmatically generate or modify
26 a lockfile -- for example, because you want to update or change a package
27 record in an existing lockfile.
28 }
29 \examples{
30
31 \dontrun{
32
33 lock <- lockfile("renv.lock")
34
35 # set the repositories for a lockfile
36 lock$repos(CRAN = "https://cran.r-project.org")
37
38 # depend on digest 0.6.22
39 lock$add(digest = "[email protected]")
40
41 # write to file
42 lock$write("renv.lock")
43
44 }
45
46 }
47 \seealso{
48 \code{\link{lockfiles}}, for a description of the structure of an
49 \code{renv} lockfile.
50 }
51 \keyword{internal}