refactor: Big internal refactor

This commit is contained in:
2026-04-05 04:15:27 +02:00
parent a7578a6b16
commit 7a83a8a4be
11 changed files with 240 additions and 201 deletions
+5 -5
View File
@@ -2,9 +2,9 @@ mod cli;
use clap::{CommandFactory, Parser};
use clap_complete::{Shell, generate as generate_complete};
use crete::cluster::get_clusters;
use crete::cluster::Cluster;
use crete::environment::PathEnvironment;
use crete::set_repo_path;
use crete::{get_repo_path, set_repo_path};
use minijinja::context;
use thiserror::Error;
@@ -19,8 +19,7 @@ enum Error {
fn generate(opts: &GlobalOpts) -> Result<(), Error> {
set_repo_path(&opts.repo);
let patch_env = PathEnvironment::new_patches();
let clusters = get_clusters(&patch_env);
let clusters = Cluster::get_all();
if clusters.is_empty() {
return Err(Error::NoClustersFound);
@@ -32,7 +31,8 @@ fn generate(opts: &GlobalOpts) -> Result<(), Error> {
}
std::fs::create_dir(&path).unwrap();
let template_env = PathEnvironment::new_templates(&opts.repo);
// Render templates
let template_env = PathEnvironment::new(&get_repo_path().join("templates"));
for template_name in &template_env {
let template = template_env.get_template(&template_name).unwrap();