From 178f8fa1792c16d5352272a3066a556a53ac0443 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 7 Mar 2026 20:47:28 +1300 Subject: [PATCH] feat: Allow validate-template to accept a local directory path --- source/src/commands/validate-template.cpp | 24 ++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/source/src/commands/validate-template.cpp b/source/src/commands/validate-template.cpp index ce02720..29fb58d 100644 --- a/source/src/commands/validate-template.cpp +++ b/source/src/commands/validate-template.cpp @@ -435,14 +435,24 @@ int validate_handler(const CommandContext& ctx) { return 1; } - // Get template info - template_info tinfo = gTemplateManager().get_template_info(template_name); - if (!tinfo.is_set()) { - error << "Template not found: " << template_name << std::endl; - return 1; - } + std::filesystem::path template_path; - std::filesystem::path template_path = tinfo.local_template_path(); + // Check if the argument is a path to a template directory + std::filesystem::path arg_path(template_name); + if (arg_path.is_relative()) + arg_path = std::filesystem::current_path() / arg_path; + if (std::filesystem::is_directory(arg_path) && std::filesystem::exists(arg_path / "template_info.env")) { + template_path = std::filesystem::canonical(arg_path); + template_name = template_path.filename().string(); + } else { + // Look up by name via template manager + template_info tinfo = gTemplateManager().get_template_info(template_name); + if (!tinfo.is_set()) { + error << "Template not found: " << template_name << std::endl; + return 1; + } + template_path = tinfo.local_template_path(); + } maketitle("Validating template: " + template_name); info << "Path: " << template_path.string() << std::endl;