previous version for "Short flag must only be a '-' and a single letter"?
xhy1219 opened this issue · 1 comments
Hi I am testing a tool released in 2018. part of the script in the tools is:
''''
library(optparse)
option_list = list(
make_option(c("-id", "--patientId"), type="character", default=NULL,
help="patient ID", metavar="character"),
''''
When I ran the script, the error is "Short flag -id must only be a '-' and a single letter". So I wonder if previous version of optparse support multiple letters for short flag? Thanks!
Previous versions of optparse
never had proper support for a short flag with multiple letters (which doesn't make sense) but early versions did not explicitly check and throw an error if a user mistakenly tried to do so. This enhanced checking was added in version 1.6.4 (66acec5).
Note short flags if present must be one letter long (such as -i
) but are also completely optional i.e.:
make_option("--patientId", type="character", default=NULL, help="patient ID", metavar="character")
is fine if you'll always be using the long flag --patientid
when calling the script. Also note if using the dest` argument one could create another long flag option
--id(note double
-) as a shorter alias to
patienid`` i.e.
make_option(''--patientid", type="character"),
make_option("--id", type="character", dest="patientid")