withHooks method
Runs action for target between its hooks. Outside a project, runs
action without hooks.
Implementation
Future<int> withHooks(
String target,
Future<int> Function(HookStack stack) action, {
String? hooksFrom,
HookOrder order = HookOrder.standard,
}) {
final project = this.project;
if (project == null) {
return action(hookStack);
}
final lifecycle = HookLifecycle(
scripts: project.scripts,
rootPath: project.rootPath,
stack: hookStack,
console: console,
runHook: (hook, stack) => runScript(hook, stack: stack),
);
return lifecycle.run(target, action, hooksFrom: hooksFrom, order: order);
}