Skip to content

Commit

Permalink
Fiddle with usage and params of use_course_details topic
Browse files Browse the repository at this point in the history
This is an internal piece of documentation, but is generating a NOTE on r-devel. It looks like this:

Documented arguments not in \usage in Rd file 'use_course_details.Rd':
    ‘destdir’ ‘zipfile’

  Functions with \usage entries need to have the appropriate \alias
  entries, and all their arguments documented.
  The \usage entries must correspond to syntactically valid R code.
  See chapter ‘Writing R documentation files’ in the ‘Writing R
  Extensions’ manual.
  • Loading branch information
jennybc committed Feb 13, 2024
1 parent 7096446 commit efa5acf
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 31 deletions.
40 changes: 20 additions & 20 deletions R/course.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,31 @@ use_zip <- function(url,
#'
#' @name use_course_details
#' @keywords internal
#' @usage
#' tidy_download(url, destdir = getwd())
#' tidy_unzip(zipfile, cleanup = FALSE)
#'

#' @param url A GitHub, DropBox, or Google Drive URL.
#' * For `create_download_url()`: A URL copied from a web browser.
#' * For `tidy_download()`: A download link for a ZIP file, possibly behind a
#' shortlink or other redirect. `create_download_url()` can be helpful for
#' creating this URL from typical browser URLs.
#' @param destdir Path to existing local directory where the ZIP file will be
#' stored. Defaults to current working directory, but note that [use_course()]
#' has different default behavior.
#' @param zipfile Path to local ZIP file.
#' @param cleanup Whether to delete the ZIP file after unpacking. In an
#' interactive session, `cleanup = NA` leads to asking the user if they
#' want to delete or keep the ZIP file.

#' @section tidy_download():
#'
#' ```
#' ## function signature
#' tidy_download(url, destdir = getwd())
#'
#' # as called inside use_course()
#' # how it's used inside use_course()
#' tidy_download(
#' url, ## after post-processing with normalize_url()
#' # url has been processed with internal helper normalize_url()
#' url,
#' # conspicuous_place() = `getOption('usethis.destdir')` or desktop or home
#' # directory or working directory
#' destdir = destdir %||% conspicuous_place()
Expand Down Expand Up @@ -198,17 +213,6 @@ use_zip <- function(url,
#'
#' Use `create_download_url()` to perform this transformation automatically.
#'
#' @param url Download link for the ZIP file, possibly behind a shortlink or
#' other redirect. See Details.
#' @param destdir Path to existing local directory where the ZIP file will be
#' stored. Defaults to current working directory, but note that [use_course()]
#' has different default behavior.
#'
#' @examples
#' \dontrun{
#' tidy_download("https://github.com/r-lib/rematch2/archive/main.zip")
#' }
#'
#' @section tidy_unzip():
#'
#' Special-purpose function to unpack a ZIP file and (attempt to) create the
Expand All @@ -234,8 +238,6 @@ use_zip <- function(url,
#' hidden files, such as `.RData`, `.Rhistory`, and those below `.git/` and
#' `.Rproj.user`.
#'
#' @param zipfile Path to local ZIP file.
#'
#' @examples
#' \dontrun{
#' tidy_download("https://github.com/r-lib/rematch2/archive/main.zip")
Expand Down Expand Up @@ -395,8 +397,6 @@ tidy_unzip <- function(zipfile, cleanup = FALSE) {
}

#' @rdname use_course_details
#' @param url a GitHub, DropBox, or Google Drive URL, as copied from a web
#' browser.
#' @examples
#' # GitHub
#' create_download_url("https://github.com/r-lib/usethis")
Expand Down
28 changes: 17 additions & 11 deletions man/use_course_details.Rd

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

0 comments on commit efa5acf

Please sign in to comment.