The errors raised by parse_args()
(and
parse_args2()
) are now of class “optparse_parse_error”.
When interactive()
is FALSE
we now print
out a usage string followed by a (less verbose) error message.
Throws a more informative error message for unknown short flags
when positional_arguments=TRUE
. Thanks Greg Minshall for
bug report (#42).
formatter
argument to OptionParser()
for a function to format the usage message (#30). By default uses the
new function IndentedHelpFormatter()
.
{optparse}
also provides the new function
TitledHelpFormatter()
. Thanks Ni Huang for suggestion.positional_arguments=TRUE
. Thanks Greg Minshall for bug
report (#34).callback
parameter of add_option
/
make_option
is not NULL
then the default of
action
is now "callback"
. Thanks Greg Minshall
for suggestion (#35).action=="callback"
in the man
page for add_option
and make_option
. Thanks
Greg Minshall for bug report (#35).action=="callback"
when
metavar==NULL
(#29). Thanks Ni Huang for bug report.action=="callback"
and
positional_argument==TRUE
(#28). Thanks Ni Huang for bug
report.interactive() == FALSE
and
print_help_and_exit == TRUE
then optparse
will
now call quit(status=0)
instead of
quit(status=1)
after printing the help message (this
matches behaviour of the python package).add_help_option=FALSE
when defining an -h
or
--help
flag. Thanks Jeff P. Bruce for bug report.getopt
requirement so that empty strings are
parsed correctly. Thanks Matthew Flickinger for bug report.add_help_option
in
OptionParser
set to FALSE
. Thanks to Jeff
Bruce for bug report.parse_args
now supports
convert_hyphens_to_underscores
argument which converts any
hyphens to underscores when returning the list of optionsparse_args2
which
wraps parse_args
with positional_arguments
set
to TRUE
and convert_hyphens_to_underscores
set
to TRUE
.optparse
should no longer give any warnings when
options(warnPartialMatchArgs=TRUE)
. Thanks Rich FitzJohn
for patch.print_help
no longer throws an error if we have a
default argument of length zero. Thanks Benjamin Tyner for bug
report.OptionParser
and OptionParserOption
S4
classes are now exported. Thanks Peter Humburg for patch.positional_arguments
of function
parse_args
now accepts one or two numeric values that
denote the minimum and maximum number of supported positional arguments.
Thanks Kirill Müller for patch.interactive() == TRUE
then parse_args
will no longer quit(status=1)
after printing a help message
but will instead throw an error. optparse
will continue to
quit(status=1)
after printing a help message for
non-interactive Rscripts unless
print_help_and_exit == FALSE
.make_option
argument type="numeric"
automatically cast to double
. Previously users might have
received an error passing negative numbers if they accidentally
specified “numeric” instead of “double”.parse_args
when we have options with no
short flag and positional_arguments=TRUE. Thanks Miroslav Posta for bug
report.description
and epilogue
arguments
to OptionParser
to allow users to add more information to
generated help messages