feat: Allow validate-template to accept a local directory path
This commit is contained in:
@@ -435,14 +435,24 @@ int validate_handler(const CommandContext& ctx) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Get template info
|
||||
std::filesystem::path 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;
|
||||
}
|
||||
|
||||
std::filesystem::path template_path = tinfo.local_template_path();
|
||||
template_path = tinfo.local_template_path();
|
||||
}
|
||||
|
||||
maketitle("Validating template: " + template_name);
|
||||
info << "Path: " << template_path.string() << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user