Skip to contents

Check if the parts of a template are in place, based on the template's spec.

Usage

check_template(template, name = "", dir = ".", spec = NULL)

Arguments

template

Name of the template (e.g., "function").

name

Name of the template instance (e.g., "test_function").

dir

Path to the base directory of the template.

spec

The template's spec; specify if template spec files do not exist.

Value

A list with results of the check:

dirPath of the checked directory.
filesPath(s) of the checked files.
specA list with the template's spec.
statusA named logical vector indicating whether each components exist.
incompleteA character vector with any existing files that still have template text.
existsall(status)
messageA character vector including messages associated with failures.

Examples

if (FALSE) {
# precheck before a new template is made
check_template("template_new", list(name = "new", context = "new", files = list("new.R")))

# check the new template after creation
check_template("new")
}