add_argument()
help
values ended in a "
(#46).
Thanks Oliver Dreschel (@oliverdreschel) for bug report.We now support the following ArgumentParser()
methods:
format_help()
format_usage()
parse_intermixed_args()
(#45)parse_known_intermixed_args()
(#45)set_defaults()
(#43). Suggestion of @oliverbothe.
When an error is thrown by ArgumentParser()$parse_args()
and interactive()
is FALSE
and getOption("error")
is NULL
then
we now use a quieter default error handler that doesn't output a trailing "Execution halted".
add_argument()
now allows "numeric" as an alias for "double" for the type
argument (#42).
Suggestion of @dariober.
ArgumentParser()
now handles description
arguments with newlines in them (#44).
Thanks Arthur Gilly (@agilly) for bug report.
ArgumentParser()$parse_args()
are now of class "argparse_parse_error".They are now less verbose when interactive()
is FALSE
(#40).
There may still be a trailing "Execution halted" line output by R's default error handler
(when interactive()
is FALSE
).
This can be silenced by setting a new error handler near the top of your Rscript e.g.
r
if (!interactive())
options(error=function(e) quit('no', status = 1, runLast = FALSE))
add_argument
now uses as.logical()
logic to cast variables
to logical values if type = "logical"
and action = "store"
or action = "append"
instead of using Python's bool()
logic (#39).
We throw an error if we would get an NA by coercion.
type = "logical"
and action = "store"
suggesting users instead use action = "store_true"
or action = "store_false"
.action == "append"
and a non-NULL
default
value (#35).
Thanks @miker985 for bug report.parse_known_args()
(#34).
Suggestion of David Lacalle Castillo (@WaterKnight1998).formatter_class
argument (as a string)
to a subparsers$add_parser()
method.
Thanks Regina (@oyxf) for bug report.ArgumentParser()
.ArgumentParser()
when using Python 3.9.
Thanks Kurt Hornik for bug report.add_help
argument in ArgumentParser
.
Thanks George Chlipala for bug report.getopt
as a dependency.R6
classes instead of proto
classes (#25).
The typical user shouldn't need to change any argparse
code
but I did make private the previously public python_code
element of the object returned by ArgumentParser()
.add_subparsers
(#14).
Suggestion of Zebulun Arendsee.add_argument_group
(#26).
Suggestion of Dario Beraldi. add_mutually_exclusive_group
(#23).
Suggestion of Vince Reuter.proto
dependency.
Thanks Christophe Poulet for bug report.type='integer'
in add_argument
.
Thanks Dominik Mueller for bug report and suggested solution.proto
has been moved from Depends
to Imports
in DESCRIPTION
.
We now use jsonlite
package instead of rjson
to parse JSON
.ArgumentParser()
Suggestion of Alex Reinhart.action='version'
.
Suggestion of Dario Beraldi.required=FALSE
in add_argument
.
Thanks Claire D. McWhite for bug report.metavar
argument of add_argument
.
Thanks Paul Newell for bug report and a patch.add_argument
now throws a warning recommending using action "store_true" or "store_false"
if type set to "logical" and action set to "store".
Suggestion of Martà Duran FerrerNULL
default in add_argument
.
Previously one could only implicitly set a NULL
default by not setting any default at all.
Suggestion of Hyunsoo Kim.choices
argument in parser$add_argument
. Thanks Christopher Small for report/request.formatter_class
argument in ArgumentParser
. Thanks Costas Bouyioukos for report/request.findpython::find_python_cmd
which is a little bit more robust than the previous argparse::find_python_cmd
.interactive() == TRUE
then parse_args
will no longer quit(status=1)
after printing a help message
but will instead throw an error. argparse
will continue to quit(status=1)
after printing a help message
for non-interactive Rscripts.parser$add_argument
for case when we specify a default vector
instead of scalar. Thanks Martin Diehl for bug report.find_python_cmd
will now also look for a python2.7
binary.Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.