docopt
Command-line interface description language for R (http://docopt.org)
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (16.1%) to scientific vocabulary
Repository
Command-line interface description language for R (http://docopt.org)
Basic Info
Statistics
- Stars: 216
- Watchers: 14
- Forks: 17
- Open Issues: 19
- Releases: 0
Metadata Files
README.md
docopt
docopt helps you to:
- define an interface for your command-line application, and
- automatically generate a parser for it.
R package docopt is an implementation of docopt in the R programming language.
See my presentation on the useR! 2014 for more details.
For more information see docopt.org
To try docopt in your browser visit try.docopt.org
Installation
The easiest way to get docopt is to install from
CRAN:
R
install.packages("docopt")
library(docopt)
Development version
The latest version of docopt can be installed from GitHub using
devtools:
R
library(devtools) # make sure to have devtools 1.4!
install_github("docopt/docopt.R")
Testing
It is tested against the tests defined for the reference implementation. It passes most tests. It currently fails tests that
- count arguments:
my_prog.R -v -vshould returnlist(v=2)
The tests can be run using devtools::test() and can be found in "tests" directory.
R
library(devtools)
devtools::test()
Usage
docopt uses the description of the command-line interface (i.e. help message docstring)
to parse command-line arguments.
```R 'Naval Fate.
Usage:
navalfate.R ship new
Options:
-h --help Show this screen.
--version Show version.
--speed=
' -> doc
library(docopt) arguments <- docopt(doc, version = 'Naval Fate 2.0') print(arguments) ```
The option parser is generated based on the docstring above that is passed to docopt function.
docopt parses the usage pattern ("Usage: ...") and option descriptions
(lines starting with dash "-") and ensures that the program invocation matches the
usage pattern; it parses options, arguments and commands based on that.
The basic idea is that a good help message has all necessary information in it to make a parser.
To execute your command-line application you need to provide path to command-line executable file
(i.e. naval_fate.R in our case) and provide relevant command-line arguments/options/commands.
For example
- To print command-line application help message:
``` $ Rscript path/to/naval_fate.R --help Naval Fate.
Usage:
navalfate.R ship new
Options:
-h --help Show this screen.
--version Show version.
--speed=
- To print command-line application version information:
$ Rscript path/to/naval_fate.R --version
Naval Fate 2.0
docoptfunction returns a list of command-line parameters and their corresponding values that can be accessed via$within your command-line application.
$ Rscript path/to/naval_fate.R ship Guardian move 10 50 --speed=20
List of 23
$ --help : logi FALSE
$ --version : logi FALSE
$ --speed : chr "20"
$ --moored : logi FALSE
$ --drifting: logi FALSE
$ ship : logi TRUE
$ new : logi FALSE
$ <name> : chr "Guardian"
$ move : logi TRUE
$ <x> : chr "10"
$ <y> : chr "50"
$ shoot : logi FALSE
$ mine : logi FALSE
$ set : logi FALSE
$ remove : logi FALSE
$ help : logi FALSE
$ version : logi FALSE
$ speed : chr "20"
$ moored : logi FALSE
$ drifting : logi FALSE
$ name : chr "Guardian"
$ x : chr "10"
$ y : chr "50"
- In case if provided command-line parameters are inconsistent with the
"Usage: ..."pattern the error message will be printed along with usage pattern examples.
```
$ Rscript path/to/navalfate.R ship mine
Error:
usage: navalfate.R ship new
usage: naval_fate.R ship
usage: naval_fate.R ship shoot
usage: naval_fate.R mine (set|remove)
usage: naval_fate.R (-h | --help)
usage: naval_fate.R --version Execution halted ```
Owner
- Name: docopt
- Login: docopt
- Kind: organization
- Location: Your terminal
- Website: http://docopt.org
- Repositories: 26
- Profile: https://github.com/docopt
GitHub Events
Total
- Commit comment event: 3
- Issues event: 1
- Watch event: 4
- Issue comment event: 3
- Push event: 5
Last Year
- Commit comment event: 3
- Issues event: 1
- Watch event: 4
- Issue comment event: 3
- Push event: 5
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Edwin de Jonge | e****e@g****m | 157 |
| Dirk Eddelbuettel | e****d@d****g | 6 |
| Andrey Smelter | a****r@g****m | 6 |
| Bjarte Johansen | b****n@g****m | 2 |
| trevorld | t****s@g****m | 1 |
| Peter Schulam | p****m@g****m | 1 |
| Steven Pav | s****n@c****o | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 36
- Total pull requests: 13
- Average time to close issues: 9 months
- Average time to close pull requests: 19 days
- Total issue authors: 29
- Total pull request authors: 8
- Average comments per issue: 3.14
- Average comments per pull request: 1.31
- Merged pull requests: 11
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- eddelbuettel (3)
- mmuurr (3)
- cysouw (2)
- lorenzwalthert (2)
- antonkulaga (2)
- zkamvar (1)
- eyzhao (1)
- yasuiniko (1)
- madsheilskov (1)
- dselivanov (1)
- aniketschneider (1)
- cboettig (1)
- rgrannell1 (1)
- lf-araujo (1)
- tanho63 (1)
Pull Request Authors
- eddelbuettel (6)
- trevorld (1)
- pschulam (1)
- lorenzwalthert (1)
- rgrannell1 (1)
- andreysmelter (1)
- shabbychef (1)
- ljos (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- cran 8,814 last-month
- Total docker downloads: 62,538,975
-
Total dependent packages: 10
(may contain duplicates) -
Total dependent repositories: 64
(may contain duplicates) - Total versions: 15
- Total maintainers: 1
cran.r-project.org: docopt
Command-Line Interface Specification Language
- Homepage: https://github.com/docopt/docopt.R
- Documentation: http://cran.r-project.org/web/packages/docopt/docopt.pdf
- License: MIT + file LICENSE
-
Latest release: 0.7.2
published over 1 year ago
Rankings
Maintainers (1)
conda-forge.org: r-docopt
- Homepage: https://github.com/docopt/docopt.R
- License: MIT
-
Latest release: 0.7.1
published about 6 years ago
Rankings
Dependencies
- methods * imports
- testthat * suggests
- actions/checkout v4 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite