File: OptionParser.Rd

package info (click to toggle)
r-cran-optparse 1.7.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 320 kB
  • sloc: sh: 9; makefile: 2
file content (65 lines) | stat: -rw-r--r-- 2,365 bytes parent folder | download | duplicates (2)
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
61
62
63
64
65
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/optparse.R
\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 = "",
  formatter = IndentedHelpFormatter
)
}
\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}

\item{formatter}{A function that formats usage text.
The function should take only one argument (an \code{OptionParser()} object).
Default is \code{\link[=IndentedHelpFormatter]{IndentedHelpFormatter()}}.
The other builtin formatter provided by this package is \code{\link[=TitledHelpFormatter]{TitledHelpFormatter()}}.}
}
\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.
}
\references{
Python's \code{optparse} library, which inspired this package,
is described here: \url{https://docs.python.org/3/library/optparse.html}
}
\seealso{
\code{\link{parse_args}} \code{\link{make_option}}
\code{\link{add_option}}
}
\author{
Trevor Davis.
}