Skip to main content

entrypoints

Function entrypoints 

Source
pub fn entrypoints(
    workflows: &[WorkflowDescriptor],
    order: &[String],
) -> Vec<WorkflowEntrypoint>
Expand description

The entry point of each group: the public recipe whose name is the group’s name.

Groups are offered in order; a group with no such recipe contributes nothing, and a group not in order follows the ones that are, by name, so a runner that could not be asked for the declaration order still produces a deterministic answer.

use majordomus_cli::environment::workflows::{entrypoints, workflows_of};
let document = serde_json::json!({ "modules": {}, "recipes": {
    "check":  { "name": "check",  "doc": "Every gate.", "private": false,
                "attributes": [{"group": "check"}], "parameters": [], "dependencies": [] },
    "check-fast": { "name": "check-fast", "doc": null, "private": false,
                "attributes": [{"group": "check"}], "parameters": [], "dependencies": [] },
    "site-build": { "name": "site-build", "doc": null, "private": false,
                "attributes": [{"group": "site"}], "parameters": [], "dependencies": [] }
}});
let found = entrypoints(&workflows_of(&document), &["check".into(), "site".into()]);
assert_eq!(found.len(), 1, "site has no recipe named `site`, so it offers none");
assert_eq!(found[0].command, "just check");