Learn R Programming

precommit (version 0.4.3)

precommit_docopt: Provide a singular interface for hook calls to docopt

Description

docopt provides different processing for a single string than an array/vector. As "string"`` and c("string")` are semantically equivalent in R, this can create problems when a single parameter is provided. Thus, this function wraps docopt to ensure that the args will always be interpreted as a vector.

Usage

precommit_docopt(doc, args = commandArgs(trailingOnly = TRUE), ...)

Arguments

doc

character vector with command line specification.

args

character vector of command line arguments. Defaults to commandArgs(trailingOnly=TRUE).

...

Additional parameters passed to docopt.

Details

This function is only exported for use in hook scripts, but it's not intended to be called by the end-user directly.

See Also

Other hook script helpers: diff_requires_run_roxygenize(), dirs_R.cache(), may_require_permanent_cache(), robust_purl(), roxygen_assert_additional_dependencies(), roxygenize_with_cache()