getTargetFilePath static method

Future<String?> getTargetFilePath()

get target file path. returns the path that the git hooks points to.

Implementation

static Future<String?> getTargetFilePath() async {
  String? commandPath = '';
  await _hooksCommand((hookFile) async {
    var hookTemplate = hookFile.readAsStringSync();
    var match = RegExp(r'dart\s(\S+)\s\$hookName').firstMatch(hookTemplate);
    if (match is RegExpMatch) {
      commandPath = match.group(1)!;
      return false;
    }
    return true;
  });
  return commandPath;
}