From afddded8fdab6925a83f1240999ebac8f76f239d Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 28 Feb 2026 12:35:07 +0800 Subject: Replace manual template processing with just_template library --- templates/_commands.rs.template | 35 +++++++++++----------- .../_override_renderer_dispatcher.rs.template | 13 ++++---- templates/_override_renderer_entry.rs.template | 15 +++++----- templates/_specific_renderer_matching.rs.template | 17 ++++++----- templates/compile_info.rs.template | 14 ++++----- templates/setup_jv_cli.iss.template | 6 ++-- 6 files changed, 52 insertions(+), 48 deletions(-) (limited to 'templates') diff --git a/templates/_commands.rs.template b/templates/_commands.rs.template index 84d2db4..c11e312 100644 --- a/templates/_commands.rs.template +++ b/templates/_commands.rs.template @@ -1,7 +1,7 @@ // Auto generated by build.rs use crate::systems::cmd::cmd_system::{JVCommand, JVCommandContext}; use crate::systems::cmd::errors::CmdProcessError; -<> + /// Input parameters, execute a command node pub async fn jv_cmd_process_node( node: &str, @@ -10,17 +10,27 @@ pub async fn jv_cmd_process_node( renderer_override: String ) -> Result { match node { -// PROCESS -// -- TEMPLATE START -- - // Command `<>` - "<>" => { +>>>>>>>>>> command_match_arms + _ => {} + } + return Err(CmdProcessError::NoNodeFound(node.to_string())); +} + +/// Get all command nodes +pub fn jv_cmd_nodes() -> Vec { + vec!<<>> +} + +@@@ >>> command_match_arms + // Command `<<>>` + "<<>>" => { if renderer_override == "default" { - return crate::<>::process_to_render_system( + return crate::<<>>::process_to_render_system( args, ctx, ) .await; } else { - return crate::<>::process_to_renderer_override( + return crate::<<>>::process_to_renderer_override( args, ctx, renderer_override, @@ -28,13 +38,4 @@ pub async fn jv_cmd_process_node( .await; } } -// -- TEMPLATE END -- - _ => {} - } - return Err(CmdProcessError::NoNodeFound(node.to_string())); -} -<> -/// Get all command nodes -pub fn jv_cmd_nodes() -> Vec { - vec!<> -} +@@@ <<< diff --git a/templates/_override_renderer_dispatcher.rs.template b/templates/_override_renderer_dispatcher.rs.template index 80cabb6..dd4f016 100644 --- a/templates/_override_renderer_dispatcher.rs.template +++ b/templates/_override_renderer_dispatcher.rs.template @@ -1,14 +1,15 @@ // Auto generated by build.rs match renderer { -// MATCH -// -- TEMPLATE START -- - "<>" => { - RendererType::render(&concrete_data).await - } -// -- TEMPLATE END -- +>>>>>>>>>> renderer_match_arms _ => { return Err(CmdProcessError::Render(CmdRenderError::RendererNotFound( renderer.to_string(), ))); } } + +@@@ >>> renderer_match_arms + "<<>>" => { + <<>>::render(&concrete_data).await + } +@@@ <<< diff --git a/templates/_override_renderer_entry.rs.template b/templates/_override_renderer_entry.rs.template index 7912cb0..d9089c9 100644 --- a/templates/_override_renderer_entry.rs.template +++ b/templates/_override_renderer_entry.rs.template @@ -1,13 +1,14 @@ // Auto generated by build.rs match type_id { -// MATCHING -// -- TEMPLATE START -- - type_id if type_id == std::any::TypeId::of::() => { +>>>>>>>>>> type_match_arms + _ => Err(CmdProcessError::NoMatchingCommand) +} + +@@@ >>> type_match_arms + type_id if type_id == std::any::TypeId::of::<<<>>>() => { let concrete_data = data - .downcast::() + .downcast::<<<>>>() .map_err(|_| CmdProcessError::DowncastFailed)?; include!("../render/_override_renderer_dispatcher.rs").map_err(CmdProcessError::Render) }, -// -- TEMPLATE END -- - _ => Err(CmdProcessError::NoMatchingCommand) -} +@@@ <<< diff --git a/templates/_specific_renderer_matching.rs.template b/templates/_specific_renderer_matching.rs.template index 4f1c7d2..bd41406 100644 --- a/templates/_specific_renderer_matching.rs.template +++ b/templates/_specific_renderer_matching.rs.template @@ -1,12 +1,13 @@ // Auto generated by build.rs match type_id { -// MATCHING -// -- TEMPLATE START -- - type_id if type_id == std::any::TypeId::of::() => { - RendererType::render( - &data.downcast::() - .unwrap()).await - }, -// -- TEMPLATE END -- +>>>>>>>>>> renderer_match_arms _ => Err(CmdRenderError::RendererNotFound(format!("{:?}", type_id))) } + +@@@ >>> renderer_match_arms + type_id if type_id == std::any::TypeId::of::<<<>>>() => { + <<>>::render( + &data.downcast::<<<>>>() + .unwrap()).await + }, +@@@ <<< diff --git a/templates/compile_info.rs.template b/templates/compile_info.rs.template index b65055b..fcaaf63 100644 --- a/templates/compile_info.rs.template +++ b/templates/compile_info.rs.template @@ -12,13 +12,13 @@ pub struct CompileInfo { impl Default for CompileInfo { fn default() -> Self { Self { - date: "{date}".to_string(), - target: "{target}".to_string(), - platform: "{platform}".to_string(), - toolchain: "{toolchain}".to_string(), - cli_version: "{version}".to_string(), - build_branch: "{branch}".to_string(), - build_commit: "{commit}".to_string(), + date: "<<>>".to_string(), + target: "<<>>".to_string(), + platform: "<<>>".to_string(), + toolchain: "<<>>".to_string(), + cli_version: "<<>>".to_string(), + build_branch: "<<>>".to_string(), + build_commit: "<<>>".to_string(), } } } diff --git a/templates/setup_jv_cli.iss.template b/templates/setup_jv_cli.iss.template index 6306ced..ae1c40f 100644 --- a/templates/setup_jv_cli.iss.template +++ b/templates/setup_jv_cli.iss.template @@ -1,7 +1,7 @@ #define MyAppName "JustEnoughVCS" -#define MyAppVersion "<<>>" -#define MyAppPublisher "<<>>" -#define MyAppURL "<<>>" +#define MyAppVersion "<<>>" +#define MyAppPublisher "<<>>" +#define MyAppURL "<<>>" [Setup] AppId={{8265DF21-F290-487E-9403-C2730EC31A03} -- cgit