1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
\name{OptionParser}
\alias{OptionParser}
\title{A function to create an instance of a parser object}
\usage{
OptionParser(usage = "usage: \%prog [options]",
option_list = list(), add_help_option = TRUE,
prog = NULL, description = "", epilogue = "")
}
\arguments{
\item{usage}{The program usage message that will printed
out if \code{parse_args} finds a help option,
\code{\%prog} is substituted with the value of the
\code{prog} argument.}
\item{option_list}{A list of of \code{OptionParserOption}
instances that will define how \code{parse_args} reacts
to command line options. \code{OptionParserOption}
instances are usually created by \code{make_option} and
can also be added to an existing \code{OptionParser}
instance via the \code{add_option} function.}
\item{add_help_option}{Whether a standard help option
should be automatically added to the \code{OptionParser}
instance.}
\item{prog}{Program name to be substituted for
\code{\%prog} in the usage message (including description
and epilogue if present), the default is to use the
actual Rscript file name if called by an Rscript file and
otherwise keep \code{\%prog}.}
\item{description}{Additional text for \code{print_help}
to print out between usage statement and options
statement}
\item{epilogue}{Additional text for \code{print_help} to
print out after the options statement}
}
\value{
An instance of the \code{OptionParser} class.
}
\description{
This function is used to create an instance of a parser
object which when combined with the \code{parse_args},
\code{make_option}, and \code{add_option} methods is very
useful for parsing options from the command line.
}
\author{
Trevor Davis.
}
\references{
Python's \code{optparse} library, which inspired this
package, is described here:
\url{http://docs.python.org/library/optparse.html}
}
\seealso{
\code{\link{parse_args}} \code{\link{make_option}}
\code{\link{add_option}}
}
|