Making some progress

This commit is contained in:
Gerald Pinder 2023-09-25 23:14:15 -04:00
parent 783c53ebb8
commit 5361b36238
3 changed files with 22 additions and 11 deletions

View file

@ -2,7 +2,8 @@ use std::{fs, io, path::PathBuf};
use anyhow::Result;
use clap::{Parser, Subcommand};
use ublue_rs::Recipe;
use tera::{Context, Tera};
use ublue_rs::{Recipe, DEFAULT_CONTAINERFILE};
#[derive(Parser, Debug)]
#[command(name = "Ublue Builder", author, version, about, long_about = None)]
@ -40,7 +41,11 @@ fn main() -> Result<()> {
containerfile,
} => {
let recipe: Recipe = serde_yaml::from_str(fs::read_to_string(recipe)?.as_str())?;
println!("{:#?}", recipe);
println!("{:#?}", &recipe);
let context = Context::from_serialize(recipe)?;
dbg!(&context);
let output = Tera::one_off(DEFAULT_CONTAINERFILE, &context, true)?;
println!("{output}");
}
CommandArgs::Build { containerfile } => {
println!("Not yet implemented!");

View file

@ -18,9 +18,9 @@ pub struct Recipe {
pub rpm: Rpm,
#[serde(rename = "usr-dir-overlays")]
pub usr_dir_overlays: Vec<String>,
pub usr_dir_overlays: Option<Vec<String>>,
pub containerfiles: Containerfiles,
pub containerfiles: Option<Containerfiles>,
pub firstboot: FirstBoot,
}