Skip to content

Commit

Permalink
Support -c | --ci in tttf.r too
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel committed Feb 28, 2024
1 parent f49ecd1 commit d6ab532
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2024-02-28 Dirk Eddelbuettel <[email protected]>

* inst/examples/tttf.r: Use env -S r -t for per-session temp dir,
support command-line argument -c | --ci to set env.var CI

2024-02-25 Dirk Eddelbuettel <[email protected]>

* DESCRIPTION (Suggests): Removed package used in only one example
Expand Down
11 changes: 8 additions & 3 deletions inst/examples/tttf.r
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env r
#!/usr/bin/env -S r -t
#
# testthat::test_file wrapper
#
# Copyright (C) 2019 - 2023 Dirk Eddelbuettel
# Copyright (C) 2019 - 2024 Dirk Eddelbuettel
#
# Released under GPL (>= 2)

Expand All @@ -15,10 +15,11 @@ suppressMessages({
})

## configuration for docopt
doc <- "Usage: tttf.r [-l LIB] [-s FILE] [-h] [-x] ARG
doc <- "Usage: tttf.r [-l LIB] [-s FILE] [-c] [-h] [-x] ARG
-l --library LIB load named library, LIB can be comma-separated
-s --source FILE source a named file
-c --ci set environment variable CI to TRUE [default: FALSE]
-h --help show this help text
-x --usage show help and short example usage"
opt <- docopt(doc) # docopt parsing
Expand Down Expand Up @@ -49,4 +50,8 @@ if (!is.null(opt$source) && file.exists(opt$source)) {
source(opt$source)
}

if (opt$ci) {
Sys.setenv(CI="TRUE")
}

testthat::test_file(path=opt$ARG)

0 comments on commit d6ab532

Please sign in to comment.