File: pkg.R

package info (click to toggle)
ess 24.01.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,780 kB
  • sloc: lisp: 23,993; makefile: 339; sh: 7
file content (26 lines) | stat: -rw-r--r-- 666 bytes parent folder | download | duplicates (5)
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

.ess_keep <- function(.x, .f, ...) {
  is_true <- vapply(.x, .f, logical(1), ...)
  .x[is_true]
}

.ess_devtools_functions <- function() {
  if (!requireNamespace("devtools")) {
    .ess_mpi_error("devtools is not installed")
    stop("internal error")
  }
  devtools_env <- asNamespace("devtools")
  exports <- getNamespaceExports("devtools")
  funs_exported <- as.list(devtools_env)[exports]

  is_first_arg <- function(f, arg) {
    args <- names(formals(f))
    length(args) && args[[1]] == arg
  }

  funs_pkg <- .ess_keep(funs_exported, is.function)
  funs_pkg <- .ess_keep(funs_pkg, is_first_arg, "pkg")
  funs_names <- sort(names(funs_pkg))

  funs_names
}