applyHooks function

Future<void> applyHooks(
  1. String hookType
)

Implementation

Future<void> applyHooks(String hookType) async {
  final commands =
      loadYaml(await File(configFile).readAsString())[hookType]["commands"];

  final Type type = commands.runtimeType;
  final List<CommandResult> results = [];

  if (type == String && commands != null) {
    results.add(await startProcess(commands, hookType));
  }

  if (type == YamlList && commands.isNotEmpty) {
    for (var command in commands) {
      results.add(await startProcess(command, hookType));
    }
  }

  printInfo(results, hookType);
}