|
5 | 5 | #' |
6 | 6 | #' @param pkg A `character` string specifying the package. This can be: |
7 | 7 | #' \itemize{ |
8 | | -#' \item an installed package name, |
| 8 | +#' \item an installed package name (e.g., `"ggplot2"`), |
9 | 9 | #' \item a full path to a package source directory, |
10 | | -#' \item a full path to a package archive file (tar.gz), or |
11 | | -#' \item a package name not installed (which will then be downloaded from CRAN). |
| 10 | +#' \item a full path to a package archive file (tar.gz), |
| 11 | +#' \item a package name not installed (which will then be downloaded from CRAN), |
| 12 | +#' \item a GitHub repository reference (e.g., `"tidyverse/ggplot2"` or |
| 13 | +#' `"github::tidyverse/ggplot2"`), |
| 14 | +#' \item a GitLab repository reference (e.g., `"gitlab::user/repo"`), |
| 15 | +#' \item a repository reference with specific branch/tag/commit |
| 16 | +#' (e.g., `"user/repo@v1.0.0"` or `"user/repo@main"`), |
| 17 | +#' \item a repository reference with subdirectory |
| 18 | +#' (e.g., `"user/repo/subdir"` for packages not at repo root), |
| 19 | +#' \item a full GitHub or GitLab web URL |
| 20 | +#' (e.g., `"https://github.com/apache/sedona-db/tree/main/r/sedonadb"` or |
| 21 | +#' `"https://github.com/ipeaGIT/r5r/tree/master/r-package"`). |
12 | 22 | #' } |
13 | 23 | #' @param file Optional. Save path for the output text file. If set, the function will return the path to the file instead of the combined text. Defaults to `NULL`. |
14 | 24 | #' @param force_fetch `logical`. If `TRUE`, the package source will be fetched from CRAN as a tar.gz archive even if the package is already installed locally. Default is `FALSE`, but when `version` is specified, it will be set to `TRUE`. |
|
45 | 55 | #' docs <- rdd_to_txt("splines") |
46 | 56 | #' cat(substr(docs, 1, 500)) |
47 | 57 | #' |
| 58 | +#' \dontrun{ |
| 59 | +#' # Extract from GitHub repository |
| 60 | +#' docs <- rdd_to_txt("r-lib/rlang") |
| 61 | +#' |
| 62 | +#' # Extract specific version from GitHub |
| 63 | +#' docs <- rdd_to_txt("r-lib/rlang@v1.1.0") |
| 64 | +#' |
| 65 | +#' # Extract from GitLab |
| 66 | +#' docs <- rdd_to_txt("gitlab::user/repo") |
| 67 | +#' } |
| 68 | +#' |
48 | 69 | #' \donttest{ |
49 | 70 | #' # set cache directory for `rdocdump` |
50 | 71 | #' rdd_set_cache_path(paste0(tempdir(), "/rdocdump_cache")) |
|
0 commit comments