Skip to content

Commit a1ef597

Browse files
ateucherjennybc
andauthored
Documentation for usethis options (#1846)
* Documentation for usethis options * Add usethis_options to pkgdown index * Fix typo Co-authored-by: Jennifer (Jenny) Bryan <[email protected]> * Edits from PR review * remove usethis.quiet from example and add usethis.overwrite * better formatting of usethis.description * move usethis.overwrite up in the list * Reformat options example in use_description() doc * document * Remove use of usethis.full_name and default version in usethis-setup.Rmd --------- Co-authored-by: Jennifer (Jenny) Bryan <[email protected]>
1 parent 418bc89 commit a1ef597

File tree

6 files changed

+147
-13
lines changed

6 files changed

+147
-13
lines changed

R/description.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@
2727
#' ```
2828
#' options(
2929
#' usethis.description = list(
30-
#' `Authors@R` = 'person("Jane", "Doe", email = "[email protected]",
31-
#' role = c("aut", "cre"),
32-
#' comment = c(ORCID = "YOUR-ORCID-ID"))',
33-
#' License = "MIT + file LICENSE",
34-
#' Language = "es"
30+
#' "Authors@R" = utils::person(
31+
#' "Jane", "Doe",
32+
#' email = "[email protected]",
33+
#' role = c("aut", "cre"),
34+
#' comment = c(ORCID = "YOUR-ORCID-ID")
35+
#' ),
36+
#' Language = "es",
37+
#' License = "MIT + file LICENSE"
3538
#' )
3639
#' )
3740
#' ```

R/usethis-package.R

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,71 @@
1010
## usethis namespace: end
1111
NULL
1212

13+
#' Options consulted by usethis
14+
#'
15+
#' @description
16+
#' User-configurable options consulted by usethis, which provide a mechanism
17+
#' for setting default behaviours for various functions.
18+
#'
19+
#' If the built-in defaults don't suit you, set one or more of these options.
20+
#' Typically, this is done in the `.Rprofile` startup file, which you can open
21+
#' for editing with [edit_r_profile()] - this will set the specified options for
22+
#' all future R sessions. Your code will look something like:
23+
#'
24+
#' ```
25+
#' options(
26+
#' usethis.description = list(
27+
#' "Authors@R" = utils::person(
28+
#' "Jane", "Doe",
29+
#' email = "[email protected]",
30+
#' role = c("aut", "cre"),
31+
#' comment = c(ORCID = "YOUR-ORCID-ID")
32+
#' ),
33+
#' License = "MIT + file LICENSE"
34+
#' ),
35+
#' usethis.destdir = "/path/to/folder/", # for use_course(), create_from_github()
36+
#' usethis.protocol = "ssh", # Use ssh git protocol
37+
#' usethis.overwrite = TRUE # overwrite files in Git repos without confirmation
38+
#' )
39+
#' ```
40+
#'
41+
#' @section Options for the usethis package:
42+
#'
43+
#' - `usethis.description`: customize the default content of new `DESCRIPTION`
44+
#' files by setting this option to a named list.
45+
#' If you are a frequent package developer, it is worthwhile to pre-configure
46+
#' your preferred name, email, license, etc. See the example above and the
47+
#' [article on usethis setup](https://usethis.r-lib.org/articles/articles/usethis-setup.html)
48+
#' for more details.
49+
#'
50+
#' - `usethis.destdir`: Default directory in which to place new projects
51+
#' downloaded by [use_course()] and [create_from_github()].
52+
#' If this option is unset, the user's Desktop or similarly conspicuous place
53+
#' will be used.
54+
#'
55+
#' - `usethis.protocol`: specifies your preferred transport protocol for Git.
56+
#' Either "https" (default) or "ssh":
57+
#' * `usethis.protocol = "https"` implies `https://github.com/<OWNER>/<REPO>.git`
58+
#' * `usethis.protocol = "ssh"` implies `git@@github.com:<OWNER>/<REPO>.git`
59+
#'
60+
#' You can also change this for the duration of your R session with
61+
#' [use_git_protocol()].
62+
#'
63+
#' - `usethis.overwrite`: If `TRUE`, usethis overwrites an existing file without
64+
#' asking for user confirmation if the file is inside a Git repo. The
65+
#' rationale is that the normal Git workflow makes it easy to see and
66+
#' selectively accept/discard any proposed changes.
67+
#'
68+
#' - `usethis.quiet`: Set to `TRUE` to suppress user-facing messages. Default
69+
#' `FALSE`.
70+
#'
71+
#' - `usethis.allow_nested_project`: Whether or not to allow
72+
#' you to create a project inside another project. This is rarely a good idea,
73+
#' so this option defaults to `FALSE`.
74+
#'
75+
#' @name usethis_options
76+
NULL
77+
1378
release_bullets <- function() {
1479
c(
1580
"Check that `use_code_of_conduct()` is shipping the latest version of the Contributor Covenant (<https://www.contributor-covenant.org>)."

_pkgdown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ reference:
106106
Configure the behaviour of R or RStudio, globally as a user or
107107
for a specific project
108108
contents:
109+
- usethis_options
109110
- use_blank_slate
110111
- use_devtools
111112
- use_usethis

man/use_description.Rd

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/usethis_options.Rd

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/articles/usethis-setup.Rmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,13 @@ Define any of these options in your `.Rprofile`, which can be opened for editing
8181

8282
```{r, eval = FALSE}
8383
options(
84-
usethis.full_name = "Jane Doe",
8584
usethis.description = list(
8685
"Authors@R" = utils::person(
8786
"Jane", "Doe",
8887
email = "[email protected]",
8988
role = c("aut", "cre"),
9089
comment = c(ORCID = "JANE'S-ORCID-ID")
91-
),
92-
Version = "0.0.0.9000"
90+
)
9391
),
9492
usethis.destdir = "~/the/place/where/I/keep/my/R/projects",
9593
usethis.overwrite = TRUE

0 commit comments

Comments
 (0)