eb_pipeline/
templates.rs

1//! Built-in site file templates.
2//!
3//! Each template is a complete, valid site file with placeholder values only
4//! (the same lint that guards the repository runs over them). `eb-pipeline
5//! init --template NAME` writes one as the starting point for a new site.
6
7/// One template: its name, a one-line summary, and the file text.
8pub struct Template {
9    /// The name `init --template` takes.
10    pub name: &'static str,
11    /// The line `init --list` prints after the name.
12    pub summary: &'static str,
13    /// The site file, as `init` writes it.
14    pub text: &'static str,
15}
16
17/// Every built-in template, by name.
18pub const TEMPLATES: &[Template] = &[
19    Template {
20        name: "small-cluster",
21        summary: "Slurm, one CPU target; no EESSI, inode quota or licences",
22        text: include_str!("../templates/small-cluster.toml"),
23    },
24    Template {
25        name: "eessi-site",
26        summary:
27            "Slurm, CPU and GPU targets on an EESSI site layer, with quota, caches and licences",
28        text: include_str!("../templates/eessi-site.toml"),
29    },
30];
31
32/// The template called `name`.
33pub fn get(name: &str) -> Option<&'static Template> {
34    TEMPLATES.iter().find(|t| t.name == name)
35}