| OptionParserOption-class | R Documentation |
Class to hold information about command-line options
short_flagString of the desired short flag
comprised of the - followed by a single non-dash character (but not = or a whitespace character).
long_flagString of the desired long flag comprised of --
followed by a non-dash character and then (optionally) more characters (but not any = or whitespace characters).
actionA character string describing the action optparse should take when it encounters an option. One of:
"append": appends each occurrence's value to default (or to an empty vector if default is NULL). Returns NULL if never seen and default is NULL.
"callback": stores the return value of the callback function.
"count": counts the number of times the flag is seen and adds it to default (treated as 0L if not supplied). Returns NULL if never seen and no default was supplied.
"store" (default): stores the specified following value.
"store_const": stores const if the flag is seen, otherwise default. Returns NULL if the flag is not seen and default is NULL.
"store_true": stores TRUE if the option is found.
"store_false": stores FALSE if the option is found.
If callback is not NULL the default action is "callback" otherwise it is "store".
typeA character string specifying which data type to store: "logical", "integer", "double", "complex", or "character" ("numeric" is an alias for "double"). Defaults:
if action == "count" then "integer"
if action %in% c("store_false", "store_true") then "logical"
if action == "store" and default is not NULL then typeof(default)else if default is NULL then "character"
destA character string specifying what field in the list returned by parse_args() should optparse store the option value. Default is derived from the long flag in opt_str.
defaultThe default value optparse should use if it does not find the option on the command line.
constThe value to store when action = "store_const" and the flag is seen. Ignored for all other actions.
requiredIf TRUE, parse_args() will throw an error if this option is not provided on the command line.
Note: Required options are generally considered bad form because users
expect options to be optional, and thus they should be avoided when possible.
helpA character string describing the option, used by print_help() in generating a usage message. "%default" will be substituted by the value of default.
metavarA character string that stands in for the option argument when printing help text. Default is the value of dest.
callbackA function that executes after the option value is fully parsed. Its return value is assigned to the option. Arguments are: the option S4 object, the long flag string, the value of the option, the parser S4 object, and ....
callback_argsA list of additional arguments passed to callback (via do.call()).
make_option()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.