-
Notifications
You must be signed in to change notification settings - Fork 11
/
man-utils.R
34 lines (30 loc) · 978 Bytes
/
man-utils.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Create a documentation section 'Addins' with name and description dynamically
# extracted from addins.dcf
man_section_addins <- function() {
addins <- read.dcf(system.file("rstudio/addins.dcf", package = "compareWith"))
c(
"@section Addins:",
"\\describe{",
sprintf("\\item{**%s**}{%s.}", addins[, "Name"], addins[, "Description"]),
"}"
)
}
# Construct a description for any of the compare_with functions
describe_compare_with <- function(what, with) {
what <- switch(
what,
path = "a file or directory",
active_file = "the active file",
active_project = "the active file"
)
with <- switch(
with,
other = "another selected by the user",
repo = "the version control repository"
)
paste("Compares", what, "against", with)
}
# Create a @describeIn tag for any compare_with function
man_describeIn_compare_with <- function(what, with) {
sprintf("@describeIn compare_with %s.", describe_compare_with(what, with))
}