Skip to content

Commit

Permalink
store the template in the template files too (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
MabezDev authored Feb 24, 2025
1 parent 73f578c commit 5eaeafb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 0 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ fn main() {
continue;
}

if path.file_name() == Some(std::ffi::OsStr::new("template.yaml")) {
continue;
}

println!("{:?} {}", path, relative_path);
let content = std::fs::read_to_string(path).unwrap();

Expand Down
12 changes: 9 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ mod check;
mod template_files;
mod tui;

const OPTIONS: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/template/template.yaml"));

static TEMPLATE: LazyLock<Template> = LazyLock::new(|| serde_yaml::from_str(OPTIONS).unwrap());
static TEMPLATE: LazyLock<Template> = LazyLock::new(|| {
serde_yaml::from_str(
template_files::TEMPLATE_FILES
.iter()
.find_map(|(k, v)| if *k == "template.yaml" { Some(v) } else { None })
.unwrap(),
)
.unwrap()
});

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
Expand Down

0 comments on commit 5eaeafb

Please sign in to comment.