Skip to content

Commit

Permalink
Export dev_topic_index() (#258)
Browse files Browse the repository at this point in the history
Closes #257
  • Loading branch information
lionel- committed Sep 20, 2023
1 parent eeb5abb commit e828276
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export(dev_example)
export(dev_help)
export(dev_meta)
export(dev_topic_find)
export(dev_topic_index)
export(dev_topic_index_reset)
export(has_tests)
export(imports_env)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# pkgload (development version)

* `dev_topic_index()` is now exported (#257).

* Fix handling of active bindings inside a package during unloading (#255, @klmr).


Expand Down
9 changes: 5 additions & 4 deletions R/dev-help.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#' In-development help for package loaded with devtools
#'
#' `dev_help` searches for source documentation provided in
#' packages loaded by devtools. To improve performance, the `.Rd` files
#' are parsed to create to index once, then cached. Use
#' `dev_topic_index_reset` to clear that index.
#' `dev_help()` searches for source documentation provided in packages
#' loaded by devtools. To improve performance, the `.Rd` files are
#' parsed to create to index once, then cached. Use
#' `dev_topic_index_reset()` to clear that index. You can manually
#' retrieve the index for a local package with `dev_topic_index()`.
#'
#' @param topic name of help to search for.
#' @param dev_packages A character vector of package names to search within.
Expand Down
6 changes: 5 additions & 1 deletion R/dev-topic.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ dev_topic_path <- function(topic, path = ".") {
# Cache -------------------------------------------------------------------

dev_topic_indices <- new.env(parent = emptyenv())

#' @rdname dev_help
#' @param path Path to package.
#' @export
dev_topic_index <- function(path = ".") {
path <- pkg_path(path)
package <- pkg_name(path)
Expand All @@ -89,9 +93,9 @@ dev_topic_index <- function(path = ".") {
dev_topic_indices[[package]]
}

#' @export
#' @rdname dev_help
#' @param pkg_name Name of package.
#' @export
dev_topic_index_reset <- function(pkg_name) {
if (exists(pkg_name, dev_topic_indices)) {
rm(list = pkg_name, envir = dev_topic_indices)
Expand Down
14 changes: 10 additions & 4 deletions man/dev_help.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e828276

Please sign in to comment.