ArgumentParser | R Documentation |
Create an object of class "essentials_ArgumentParser"
, for parsing the
command-line arguments into a more usable form.
ArgumentParser(program = NA, usage = NA, description = NA, epilogue = NA,
add.help = TRUE,
wrap = TRUE, indent = 0, exdent = 0,
wrap.description = wrap,
indent.description = indent,
exdent.description = exdent,
wrap.epilogue = wrap,
indent.epilogue = indent,
exdent.epilogue = exdent,
style = NA, wrap.help = FALSE, help.help = default.help("help"),
..., help.message = NULL, n = 0)
program |
character string. The name of the program (by default, the
|
usage |
character string. The usage of the program (by default,
determined by |
description , epilogue |
character vector. Messages to display before and after the arguments help. |
add.help |
logical. Should a help option be added to the parser? |
wrap.help , help.help , ... |
further arguments passed to
|
wrap , wrap.description , wrap.epilogue |
logical. Should the messages be
|
indent , indent.description , indent.epilogue |
a non-negative integer giving the indentation of the first line in a paragraph. |
exdent , exdent.description , exdent.epilogue |
a non-negative integer giving the indentation of the subsequent lines in a paragraph. |
style |
integer. How to stylize the help message. |
help.message |
character vector or |
n |
argument passed to |
All of the above arguments help form the documentation for your argument
parser. The documentation will be printed in a similar manner to R's
command-line documentation. First, the usage will be printed. This includes
the name of the program (the basename
of the executing
script), the names of the formal arguments, and the names of the sub-commands
(if any). Second, the description of the program will be printed.
An object of class "essentials_ArgumentParser"
is a
reference
class. This allows us to use
argument parsers in an almost identical manner to the
argparse
module from Python. All arguments to ArgumentParser
are used for
printing a help message.
An object of class "essentials_ArgumentParser"
.
add.argument
Declare a formal argument for an argument parser.
add.subparsers
Declare
The argparse module for Python.
x <- essentials::ArgumentParser()
x$print.help()
y <- essentials::ArgumentParser(description = "A description for the program",
epilogue = c(" --- Final Message --- ",
"A final message for the program, do not wrap this message"),
wrap.epilogue = FALSE)
y$print.help()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.