load all recipes from repo

This commit is contained in:
Sebastian Kuzminsky 2025-01-17 20:10:00 -07:00
parent 57b8dae357
commit f28aeaf321
3 changed files with 68 additions and 10 deletions

View file

@ -54,9 +54,18 @@ pub struct Recipe {
outputs: Option<Vec<String>>,
}
pub fn validate_recipe(recipe: &Recipe) -> anyhow::Result<()> {
// if recipe.inputs.len() == 0 {
// Err("recipe has no inputs!");
// }
Ok(())
impl Recipe {
pub fn from_file(file: &std::path::PathBuf) -> anyhow::Result<Self> {
let recipe_contents = std::fs::read_to_string(file)?;
let recipe: Recipe = toml::from_str(&recipe_contents)?;
// let r = recipe.validate_recipe();
Ok(recipe)
}
fn validate_recipe(self: &Self) -> anyhow::Result<()> {
// if recipe.inputs.len() == 0 {
// Err("recipe has no inputs!");
// }
Ok(())
}
}