1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
# standalone_header() works with various inputs
Code
standalone_header("OWNER/REPO", "R/standalone-foo.R")
Output
[1] "# Standalone file: do not edit by hand"
[2] "# Source: https://github.com/OWNER/REPO/blob/HEAD/R/standalone-foo.R"
[3] "# Generated by: usethis::use_standalone(\"OWNER/REPO\", \"foo\")"
[4] "# ----------------------------------------------------------------------"
[5] "#"
---
Code
standalone_header("OWNER/REPO", "R/standalone-foo.R", ref = "blah")
Output
[1] "# Standalone file: do not edit by hand"
[2] "# Source: https://github.com/OWNER/REPO/blob/blah/R/standalone-foo.R"
[3] "# Generated by: usethis::use_standalone(\"OWNER/REPO\", \"foo\", ref = \"blah\")"
[4] "# ----------------------------------------------------------------------"
[5] "#"
---
Code
standalone_header("OWNER/REPO", "R/standalone-foo.R", host = "https://github.com")
Output
[1] "# Standalone file: do not edit by hand"
[2] "# Source: https://github.com/OWNER/REPO/blob/HEAD/R/standalone-foo.R"
[3] "# Generated by: usethis::use_standalone(\"OWNER/REPO\", \"foo\")"
[4] "# ----------------------------------------------------------------------"
[5] "#"
---
Code
standalone_header("OWNER/REPO", "R/standalone-foo.R", host = "https://github.acme.com")
Output
[1] "# Standalone file: do not edit by hand"
[2] "# Source: https://github.acme.com/OWNER/REPO/blob/HEAD/R/standalone-foo.R"
[3] "# Generated by: usethis::use_standalone(\"OWNER/REPO\", \"foo\", host = \"https://github.acme.com\")"
[4] "# ----------------------------------------------------------------------"
[5] "#"
---
Code
standalone_header("OWNER/REPO", "R/standalone-foo.R", ref = "blah", host = "https://github.com")
Output
[1] "# Standalone file: do not edit by hand"
[2] "# Source: https://github.com/OWNER/REPO/blob/blah/R/standalone-foo.R"
[3] "# Generated by: usethis::use_standalone(\"OWNER/REPO\", \"foo\", ref = \"blah\")"
[4] "# ----------------------------------------------------------------------"
[5] "#"
---
Code
standalone_header("OWNER/REPO", "R/standalone-foo.R", ref = "blah", host = "https://github.acme.com")
Output
[1] "# Standalone file: do not edit by hand"
[2] "# Source: https://github.acme.com/OWNER/REPO/blob/blah/R/standalone-foo.R"
[3] "# Generated by: usethis::use_standalone(\"OWNER/REPO\", \"foo\", ref = \"blah\", host = \"https://github.acme.com\")"
[4] "# ----------------------------------------------------------------------"
[5] "#"
# can offer choices
Code
standalone_choose("tidyverse/forcats", ref = "v1.0.0")
Condition
Error:
! No standalone files found in tidyverse/forcats.
Code
standalone_choose("r-lib/rlang", ref = "4670cb233ecc8d11")
Condition
Error:
! `file` is absent, but must be supplied.
i Possible options are cli, downstream-deps, lazyeval, lifecycle, linked-version, obj-type, purrr, rlang, s3-register, sizes, types-check, vctrs, or zeallot.
# can extract imports
Code
extract_imports("# imports: rlang (== 1.0.0)")
Condition
Error in `extract_imports()`:
! Version specification must use `>=`.
Code
extract_imports("# imports: rlang (>= 1.0.0), purrr")
Condition
Error in `extract_imports()`:
! Version field can't contain comma.
i Do you need to wrap in a list?
Code
extract_imports("# imports: foo (>=0.0.0)")
Condition
Error in `extract_imports()`:
! Can't parse version `foo (>=0.0.0)` in `imports:` field.
i Example of expected version format: `rlang (>= 1.0.0)`.
# errors on malformed dependencies
Code
standalone_dependencies(c(), "test.R")
Condition
Error:
! Can't find yaml metadata in 'test.R'.
Code
standalone_dependencies(c("# ---", "# dependencies: 1", "# ---"), "test.R")
Condition
Error:
! Invalid dependencies specification in 'test.R'.
|