Skip to contents

Unlike usethis::use_git_hook(), this function checks to see if you already have a pre-commit hook, and attempts to add to it while avoiding duplication. The checks are imperfect, which is probably why this isn't in usethis this way. It will also fail if something exits early on success before everything has ran.

Usage

use_precommit_hook(hook, priority = 0)

Arguments

hook

Character. The hook to add, with one line of output per element of the vector.

priority

Where to put the hook. By default the hook is added at the end. Higher-priority hooks will be added higher up.

Value

NULL (invisibly).