Skip to content

Commit 334b210

Browse files
Add support for comma-separated values in CLI arguments
1 parent 4794b19 commit 334b210

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: parallelly
2-
Version: 1.45.1-9018
2+
Version: 1.45.1-9019
33
Title: Enhancing the 'parallel' Package
44
Imports:
55
parallel,

R/010.cli.R

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,21 @@ parse_cmd_args <- function(patterns = list(), cmdargs = getOption("future.p2p.te
1212
name <- gsub(pattern, "\\1", cmdarg)
1313
value <- gsub(pattern, "\\2", cmdarg)
1414
if (!is.null(type)) {
15-
if (type == "character") {
16-
value <- as.character(value)
17-
} else if (type == "logical") {
18-
value <- as.logical(value)
19-
} else if (type == "integer") {
20-
value <- as.integer(value)
21-
} else if (type == "numeric") {
22-
value <- as.numeric(value)
23-
} else if (type == "expr") {
15+
if (type == "expr") {
2416
value <- local(eval(parse(text = value)))
2517
} else {
26-
stop("Unknown cli_arg type: ", sQuote(type))
18+
value <- strsplit(value, split = ",", fixed = TRUE)[[1]]
19+
if (type == "character") {
20+
value <- as.character(value)
21+
} else if (type == "logical") {
22+
value <- as.logical(value)
23+
} else if (type == "integer") {
24+
value <- as.integer(value)
25+
} else if (type == "numeric") {
26+
value <- as.numeric(value)
27+
} else {
28+
stop("Unknown cli_arg type: ", sQuote(type))
29+
}
2730
}
2831
}
2932
class(value) <- "cmd_arg"

inst/testme/test-supportsMulticore.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ Sys.setenv(RSTUDIO = "1")
5555
Sys.setenv(RSTUDIO_TERM = "1")
5656
res <- supportsMulticoreAndRStudio()
5757
print(res)
58-
stopifnot(
59-
if (.Platform[["OS.type"]] == "windows") isFALSE(res) else isTRUE(res)
60-
)
58+
stopifnot(isTRUE(res))
6159

6260
opts <- options(parallelly.supportsMulticore.disableOn = "rstudio_terminal")
6361
res <- supportsMulticoreAndRStudio()

0 commit comments

Comments
 (0)