r-lib / usethis
1
#' Use a basic `NAMESPACE`
2
#'
3
#' If `roxygen` is `TRUE` generates an empty `NAMESPACE` that exports nothing;
4
#' you'll need to explicitly export functions with `@export`. If `roxygen`
5
#' is `FALSE`, generates a default `NAMESPACE` that exports all functions
6
#' except those that start with `.`.
7
#'
8
#' @param roxygen Do you plan to manage `NAMESPACE` with roxygen2?
9
#' @seealso The [namespace chapter](https://r-pkgs.org/namespace.html) of
10
#'   [R Packages](https://r-pkgs.org).
11
#' @export
12
use_namespace <- function(roxygen = TRUE) {
13 1
  check_is_package("use_namespace()")
14

15 1
  path <- proj_path("NAMESPACE")
16 1
  if (roxygen) {
17 1
    write_over(path, c("# Generated by roxygen2: do not edit by hand", ""))
18
  } else {
19 0
    write_over(path, 'exportPattern("^[^\\\\.]")')
20
  }
21
}

Read our documentation on viewing source code .

Loading