-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Unfortunately, #19 does not seem resolved, in fact made things worse for my use case. I caught the command line args with commandArgs(TRUE)
so I you should be able to reproduce this easily:
With the CRAN version
#!/usr/bin/env Rscript
"style files.
Usage:
style_files [--arg=<arg1>] <files>...
Options:
--arg=<arg1> Package where the style guide is stored [default: Arg1].
" -> doc
saveRDS(commandArgs(TRUE), "cmd.rds")
# expected behavior
docopt::docopt(doc, c("--arg=tidyverse_style(scope=\"none\")", "R/test.R"))
#> List of 4
#> $ --arg : chr "tidyverse_style(scope=\"none\")"
#> $ <files>: chr "R/test.R"
#> $ arg : chr "tidyverse_style(scope=\"none\")"
#> $ files : chr "R/test.R"
#> NULL
# unexpected: I add a space, it does not work anymore
docopt::docopt(doc, c("--arg=tidyverse_style(scope = \"none\")", "R/test.R"))
#> List of 4
#> $ --arg : chr "tidyverse_style(scope"
#> $ <files>: chr [1:3] "=" "none)" "R/test.R"
#> $ arg : chr "tidyverse_style(scope"
#> $ files : chr [1:3] "=" "none)" "R/test.R"
#> NULL
Created on 2020-06-15 by the reprex package (v0.3.0)
With the GitHub version
#!/usr/bin/env Rscript
"style files.
Usage:
style_files [--arg=<arg1>] <files>...
Options:
--arg=<arg1> Package where the style guide is stored [default: Arg1].
" -> doc
saveRDS(commandArgs(TRUE), "cmd.rds")
# unexpected: Seems like spaces are removed around 'none'.
docopt::docopt(doc, c("--arg=tidyverse_style(scope=\"none\")", "R/test.R"))
#> List of 4
#> $ --arg : chr "tidyverse_style(scope=none)"
#> $ <files>: chr "R/test.R"
#> $ arg : chr "tidyverse_style(scope=none)"
#> $ files : chr "R/test.R"
#> NULL
# unexpected: something else went wrong here
docopt::docopt(doc, c("--arg=tidyverse_style(scope = \"none\")", "R/test.R"))
#> List of 4
#> $ --arg : chr "tidyverse_style(scope"
#> $ <files>: chr [1:3] "=" "none)" "R/test.R"
#> $ arg : chr "tidyverse_style(scope"
#> $ files : chr [1:3] "=" "none)" "R/test.R"
#> NULL
Created on 2020-06-15 by the reprex package (v0.3.0)
Metadata
Metadata
Assignees
Labels
No labels