add_github_url_to_desc {packager} | R Documentation |
Add a github
URL to File ‘DESCRIPTION’
Description
When writing packages, I often forget to add the appropriate github
URL.
Usage
add_github_url_to_desc(path = ".", default_gh_user = NULL, normalize = TRUE)
Arguments
path |
Path to the package directory (see
|
default_gh_user |
See details. |
normalize |
Passed to
|
Details
The URL is constructed by the package's name as read from it's file
‘DESCRIPTION’, and the username returned by
whoami::gh_username
.
whoami::gh_username
allows for a fallback,
this is given by default_gh_user
.
You can specify default_gh_user = NA
, to try to retrieve the username
by searching remotes on github
if the
package is a git repository. We do not use
gert::git_signature_default
since there's no way to make sure
the configured git user name, locally or globally, is a github
username.
Value
Invisibly TRUE
if
adding a github
URL, FALSE
otherwise.
Examples
path <- file.path(tempdir(), "myPackage")
usethis::create_package(path, open = FALSE)
add_github_url_to_desc(path)
grep("^URL:", readLines(file.path(path, "DESCRIPTION")), value = TRUE)
unlink(path, recursive = TRUE)
[Package packager version 1.15.3 Index]