ReRegisterHooks class final

The ReRegisterHooks task automates the process of re-registering Git hooks whenever any hook files are created, modified, or deleted. This ensures that changes to your hooks are applied: Dart sources are compiled into executables under .dart_tool/hooksman/, and thin shims are written to hooks/_ (Git's core.hooksPath).

Example usage:

Hook main() {
  return PreCommitHook(
    tasks: [
      ReRegisterHooks(),
    ],
  );
}

If your hooks directory is not found in the root of your project, you can specify the path to the hooks directory:

ReRegisterHooks(pathToHooksDir: 'path/to/hooks'),
Inheritance

Constructors

ReRegisterHooks({String? pathToHooksDir})

Properties

exclude → List<Pattern>
The list of patterns to exclude files.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
id → String
The unique identifier for the task.
finalinherited
include → List<Pattern>
The list of patterns to include files.
finalinherited
name → String
The name of the task.
no setterinherited
patternName → String
Gets the pattern name for the task.
no setterinherited
resolvedName → String
Gets the resolved name for the task.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shouldAlwaysRun → bool
no setterinherited
workingDirectory → String?
finalinherited

Methods

filterFiles(Iterable<String> filePaths) → List<String>
Filters the given file paths based on the include and exclude patterns.
inherited
label(Iterable<String> filePaths) → TaskLabel
Creates a label for the task with the given file paths.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(List<String> filePaths, int index) → ResolvedHookTask
Resolves the task with the given file paths and index.
inherited
resolveSubTasks(Iterable<String> filePaths) → List<HookTask>
Resolves the list of sub-tasks for the given file paths.
inherited
run(List<String> filePaths, {required void print(String?), required void completeTask(HookTask, int), required void startTask(HookTask), required String? workingDirectory}) → FutureOr<int>
Runs the task with the given file paths.
inherited
subTasks(Iterable<String> filePaths) → List<HookTask>
Gets the list of sub-tasks for the given file paths.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited