Type: | Package |
Title: | Command-Line Interface Specification Language |
Version: | 0.7.2 |
Maintainer: | Edwin de Jonge <edwindjonge@gmail.com> |
Description: | Define a command-line interface by just giving it a description in the specific format. |
License: | MIT + file LICENSE |
URL: | https://github.com/docopt/docopt.R |
BugReports: | https://github.com/docopt/docopt.R/issues |
Imports: | methods |
Suggests: | testthat |
RoxygenNote: | 7.3.2 |
Encoding: | UTF-8 |
NeedsCompilation: | no |
Packaged: | 2025-03-25 21:06:03 UTC; edwin |
Author: | Edwin de Jonge |
Repository: | CRAN |
Date/Publication: | 2025-03-25 21:30:06 UTC |
Docopt command line specification
Description
docopt helps you to define an interface for your command-line app, and automatically generate a parser for it.
Details
For more information see http://docopt.org
Author(s)
Maintainer: Edwin de Jonge edwindjonge@gmail.com (ORCID)
See Also
Useful links:
index tokens
Description
index tokens
Usage
## S4 replacement method for signature 'Tokens'
x[i] <- value
index tokens
Description
index tokens
Usage
## S4 method for signature 'Tokens'
x[i, drop = TRUE]
as.character.Pattern
Description
as.character.Pattern
Usage
## S4 method for signature 'Pattern'
as.character(x, ...)
to character
Description
to character
Usage
## S4 method for signature 'Tokens'
as.character(x, ...)
Parse args
based on command-line interface described in doc
.
Description
docopt
creates your command-line interface based on its
description that you pass as doc
.
Such description can contain
–options, <positional-argument>, commands, which could be
[optional], (required), (mutually | exclusive) or repeated...
Usage
docopt(
doc,
args = commandArgs(TRUE),
name = NULL,
help = TRUE,
version = NULL,
strict = FALSE,
strip_names = !strict,
quoted_args = !strict
)
Arguments
doc |
|
args |
|
name |
Currently not used |
help |
|
version |
|
strict |
|
strip_names |
if |
quoted_args |
if |
Value
named list with all parsed options, arguments and commands.
References
Examples
"Usage: my_program.R [-hso FILE] [--quiet | --verbose] [INPUT ...]
-h --help show this
-s --sorted sorted output
-o FILE specify output file [default: ./test.txt]
--quiet print less text
--verbose print more text" -> doc
docopt(doc, "-s --quiet")