read static method

ActionCatalog read({
  1. Directory? from,
})

Reads docs/spec/actions.yaml of the repository that holds from (default: the working directory), walking up to the folder that has it. Without such a folder (an app under test in the macOS app sandbox, which cannot read the repository) it uses embedded.

Implementation

static ActionCatalog read({Directory? from}) {
  var dir = (from ?? Directory.current).absolute;
  while (true) {
    final file = File('${dir.path}/docs/spec/actions.yaml');
    if (file.existsSync()) return _parse(file.readAsStringSync());
    final parent = dir.parent;
    if (parent.path == dir.path) return embedded();
    dir = parent;
  }
}