VerboseHook class

The VerboseHook class extends the Hook class to provide verbose output during the execution of tasks. This class is useful for understanding the order of execution and the files being processed.

Usage

To use the VerboseHook, instantiate it with the desired tasks:

import 'package:hooksman/hooksman.dart';

VerboseHook main() {
  return VerboseHook(
    tasks: [
      ReRegisterHooks(),
      ShellTask(
        name: 'Lint & Format',
        include: [Glob('**.dart')],
        exclude: [Glob('**.g.dart')],
        commands: (filePaths) => [
          'dart analyze --fatal-infos ${filePaths.join(' ')}',
          'dart format ${filePaths.join(' ')}',
        ],
      ),
      ShellTask(
        name: 'Build Runner',
        include: [Glob('lib/models/**.dart')],
        exclude: [Glob('**.g.dart')],
        commands: (filePaths) => [
          'sip run build_runner build',
        ],
      ),
      ShellTask(
        name: 'Tests',
        include: [Glob('**.dart')],
        exclude: [Glob('hooks/**')],
        commands: (filePaths) => [
          'sip test --concurrent --bail',
        ],
      ),
    ],
  );
}

This will enable verbose output, providing detailed information about the tasks being executed. Note that this will slow down the execution of the tasks and is not intended for use in production environments.

Inheritance

Constructors

VerboseHook({required List<HookTask> tasks, List<String> diffArgs = const [], bool allowEmpty = false, String? diffFilters, bool? backupFiles})

Properties

allowEmpty bool
If true, the hook will exit successfully even if there are no files after the tasks have run
finalinherited
backupFiles bool
If true, the original files will be backed up before running the hook
finalinherited
diffArgs List<String>
Defaults to '--staged'
finalinherited
diffFilters String?
Defaults to 'ACMR'
finalinherited
hashCode int
The hash code for this object.
no setterinherited
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
tasks List<HookTask>
latefinalinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(List<String> filePaths) ResolvedHook
inherited
toString() String
A string representation of this object.
inherited

Operators

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