Script constructor

Script({
  1. required String name,
  2. required String command,
  3. List<String>? runInPackages,
  4. required String? runHooksFrom,
  5. Map<String, String>? env,
})

Implementation

factory Script({
  required String name,
  required String command,
  List<String>? runInPackages,
  required String? runHooksFrom,
  Map<String, String>? env,
}) {
  final type = HookType.values.firstWhere(
    (type) => type.name == name,
    orElse: () => HookType.none,
  );

  return Script._(
    name: name,
    command: command,
    runInPackages: runInPackages,
    hookType: type,
    runHooksFrom: runHooksFrom,
    env: env,
  );
}