% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/optparse.R
\docType{class}
\name{OptionParserOption-class}
\alias{OptionParserOption-class}
\alias{OptionParserOption}
\title{Class to hold information about command-line options}
\description{
Class to hold information about command-line options
}
\section{Slots}{

\describe{
\item{\code{short_flag}}{String of the desired short flag
comprised of the \code{-} followed by a single non-dash character (but not \code{=} or a whitespace character).}

\item{\code{long_flag}}{String of the desired long flag comprised of \verb{--}
followed by a non-dash character and then (optionally) more characters (but not any \code{=} or whitespace characters).}

\item{\code{action}}{A character string describing the action \code{optparse} should take when it encounters an option. One of:
\itemize{
\item \code{"append"}: appends each occurrence's value to \code{default} (or to an empty vector if \code{default} is \code{NULL}). Returns \code{NULL} if never seen and \code{default} is \code{NULL}.
\item \code{"callback"}: stores the return value of the \code{callback} function.
\item \code{"count"}: counts the number of times the flag is seen and adds it to \code{default} (treated as \code{0L} if not supplied). Returns \code{NULL} if never seen and no \code{default} was supplied.
\item \code{"store"} (default): stores the specified following value.
\item \code{"store_const"}: stores \code{const} if the flag is seen, otherwise \code{default}. Returns \code{NULL} if the flag is not seen and \code{default} is \code{NULL}.
\item \code{"store_true"}: stores \code{TRUE} if the option is found.
\item \code{"store_false"}: stores \code{FALSE} if the option is found.
}

If \code{callback} is not \code{NULL} the default action is \code{"callback"} otherwise it is \code{"store"}.}

\item{\code{type}}{A character string specifying which data type to store: \code{"logical"}, \code{"integer"}, \code{"double"}, \code{"complex"}, or \code{"character"} (\code{"numeric"} is an alias for \code{"double"}). Defaults:
\itemize{
\item if \code{action == "count"} then \code{"integer"}
\item if \code{action \%in\% c("store_false", "store_true")} then \code{"logical"}
\item if \code{action == "store"} and \code{default} is not \code{NULL} then \code{typeof(default)}else if \code{default} is \code{NULL} then \code{"character"}
}}

\item{\code{dest}}{A character string specifying what field in the list returned by \code{\link[=parse_args]{parse_args()}} should \code{optparse} store the option value. Default is derived from the long flag in \code{opt_str}.}

\item{\code{default}}{The default value \code{optparse} should use if it does not find the option on the command line.}

\item{\code{const}}{The value to store when \code{action = "store_const"} and the flag is seen. Ignored for all other actions.}

\item{\code{required}}{If \code{TRUE}, \code{\link[=parse_args]{parse_args()}} will throw an error if this option is not provided on the command line.
\strong{Note:} Required options are generally considered bad form because users
expect \emph{options} to be \emph{optional}, and thus they should be avoided when possible.}

\item{\code{help}}{A character string describing the option, used by \code{\link[=print_help]{print_help()}} in generating a usage message. \code{"\%default"} will be substituted by the value of \code{default}.}

\item{\code{metavar}}{A character string that stands in for the option argument when printing help text. Default is the value of \code{dest}.}

\item{\code{callback}}{A 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 \code{...}.}

\item{\code{callback_args}}{A list of additional arguments passed to \code{callback} (via \code{\link[=do.call]{do.call()}}).}
}}

\seealso{
\code{\link[=make_option]{make_option()}}
}
