Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
666 B

4 years ago
  1. .ess_keep <- function(.x, .f, ...) {
  2. is_true <- vapply(.x, .f, logical(1), ...)
  3. .x[is_true]
  4. }
  5. .ess_devtools_functions <- function() {
  6. if (!requireNamespace("devtools")) {
  7. .ess_mpi_error("devtools is not installed")
  8. stop("internal error")
  9. }
  10. devtools_env <- asNamespace("devtools")
  11. exports <- getNamespaceExports("devtools")
  12. funs_exported <- as.list(devtools_env)[exports]
  13. is_first_arg <- function(f, arg) {
  14. args <- names(formals(f))
  15. length(args) && args[[1]] == arg
  16. }
  17. funs_pkg <- .ess_keep(funs_exported, is.function)
  18. funs_pkg <- .ess_keep(funs_pkg, is_first_arg, "pkg")
  19. funs_names <- sort(names(funs_pkg))
  20. funs_names
  21. }