-12 even when
storage mode is not “double” or “integer” (e.g. when storage mode is
“character” or “complex”). If the option’s action is “store_optional”
with a storage mode other than “double” or “integer” we will now store
such negative numbers instead of treating them as a short flag bundle
and if the option’s action is “store” we will store such negative
numbers instead of throwing an error.spec now only
casts any taken argument values to the requested storage mode. In
particular store_true now never casts to the requested
storage mode and store_optional only casts to the requested
storage mode when the optional argument value is present and taken. This
was the documented behaviour and the previous/current behavior for short
flags.getopt() now has support for positional arguments
(operands) (#2):
getopt() now has an operand argument
that controls how positional arguments (operands) are handled:
"after--only" (the default) only collects operands that
appear after a "--" separator."strict" (in addition to operands that appear after a
"--" separator) collects tokens that do not look like flags
and were not consumed as a flag argument, while still erroring on
unrecognized flags.Any positional arguments are returned in the "operand"
attribute of the output.
New getoperand() function to extract the positional
arguments (operands) stored in the "operand" attribute of
output of getopt().
getopt() and getusage() now support
action strings in column 3 of spec (#11):
"append" appends each argument to a vector each time
the flag is used."count" stores integer count of each time the flag is
used."store" stores argument value, legacy 1
supported as an alias."store_false" stores FALSE."store_optional" stores argument value if present
otherwise stores TRUE, legacy 2 supported as
an alias."store_true" stores TRUE, legacy
0 supported as an alias.New getfile() function returns name of calling
script, it is an alias of pre-existing
get_Rscript_filename().
New getusage() function generates a usage string
from a getopt spec matrix.
getfile() now also checks the
LITTLER_SCRIPT_PATH environment variable so it works when
called from littler (#16).spec argument of getopt() and
getusage() may now also be a 4-5 column data frame (which
will be silently coerced to a matrix).getopt() is now of S3 class
"getopt" and no longer contains an
character(0L) ARGS element.{covr} is no longer a “suggested” package in the
DESCRIPTION file.getopt() won’t override a user specified
opt argument if argv is in the global
environment. Will continue to use argv as a default for
opt if it is in the global environment and the user does
not specify an opt argument (for littler
compatibility).na.omit() method from the
stats package. Thanks Derrick Oswald for bug report.storage.mode() coercion results in an NA.
Thanks Roman Zenka for suggestion.sort_list().getopt now uses
that value instead of throwing a “long flag is ambiguous” error.get_Rscript_filename() that
returns name of calling script, {getopt} now uses this
function value as default for command argument.{getopt} and {optparse} packages for new
undecided users.