Class to hold information about command-line options
Source:R/optparse.R
OptionParserOption-class.RdClass to hold information about command-line options
Slots
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
optparseshould take when it encounters an option. One of:"append": appends each occurrence's value todefault(or to an empty vector ifdefaultisNULL). ReturnsNULLif never seen anddefaultisNULL."callback": stores the return value of thecallbackfunction."count": counts the number of times the flag is seen and adds it todefault(treated as0Lif not supplied). ReturnsNULLif never seen and nodefaultwas supplied."store"(default): stores the specified following value."store_const": storesconstif the flag is seen, otherwisedefault. ReturnsNULLif the flag is not seen anddefaultisNULL."store_true": storesTRUEif the option is found."store_false": storesFALSEif the option is found.
If
callbackis notNULLthe 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"anddefaultis notNULLthentypeof(default)else ifdefaultisNULLthen"character"
destA character string specifying what field in the list returned by
parse_args()shouldoptparsestore the option value. Default is derived from the long flag inopt_str.defaultThe default value
optparseshould 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 ofdefault.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(viado.call()).