configure method

  1. @override
Step configure()
override

Composes Steps into one unit to enable more modular and understandable workflows.

Has to return a Step.

Implementation

@override
Step configure() => Runnable(name: name, (context) {
  if (programs.isEmpty) {
    context.send(
      Response("No programs received to look out for.", Level.verbose),
    );
    return;
  }

  final List<String> notAvailable = search(
    programs,
    directories,
    searchCanStartProcesses,
  );

  if (notAvailable.isEmpty) {
    if (onSuccess != null) {
      onSuccess!(context);
    }
    context.send(Response("All programs were found without issues."));
    return;
  }
  if (onFailure != null) {
    onFailure!(context, notAvailable);
  }
  context.send(
    Response(
      "Not all programs were found. Missing are ${notAvailable.join(", ")}.",
      Level.verbose,
    ),
  );
});