summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-02-28 12:35:07 +0800
committer魏曹先生 <1992414357@qq.com>2026-02-28 12:35:07 +0800
commitafddded8fdab6925a83f1240999ebac8f76f239d (patch)
tree16d692f32e15824863907156ad1d4ed8c7b29576 /templates
parenta469c6684619c9677dfc1125886acc37f24c81d4 (diff)
Replace manual template processing with just_template library
Diffstat (limited to 'templates')
-rw-r--r--templates/_commands.rs.template35
-rw-r--r--templates/_override_renderer_dispatcher.rs.template13
-rw-r--r--templates/_override_renderer_entry.rs.template15
-rw-r--r--templates/_specific_renderer_matching.rs.template17
-rw-r--r--templates/compile_info.rs.template14
-rw-r--r--templates/setup_jv_cli.iss.template6
6 files changed, 52 insertions, 48 deletions
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;
-<<LINE>>
+
/// 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<crate::systems::render::renderer::JVRenderResult, crate::systems::cmd::errors::CmdProcessError> {
match node {
-// PROCESS
-// -- TEMPLATE START --
- // Command `<<KEY>>`
- "<<NODE_NAME>>" => {
+>>>>>>>>>> command_match_arms
+ _ => {}
+ }
+ return Err(CmdProcessError::NoNodeFound(node.to_string()));
+}
+
+/// Get all command nodes
+pub fn jv_cmd_nodes() -> Vec<String> {
+ vec!<<<nodes>>>
+}
+
+@@@ >>> command_match_arms
+ // Command `<<<key>>>`
+ "<<<node_name>>>" => {
if renderer_override == "default" {
- return crate::<<COMMAND_TYPE>>::process_to_render_system(
+ return crate::<<<cmd_type>>>::process_to_render_system(
args, ctx,
)
.await;
} else {
- return crate::<<COMMAND_TYPE>>::process_to_renderer_override(
+ return crate::<<<cmd_type>>>::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()));
-}
-<<LINE>>
-/// Get all command nodes
-pub fn jv_cmd_nodes() -> Vec<String> {
- vec!<<NODES>>
-}
+@@@ <<<
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 --
- "<<NAME>>" => {
- RendererType::render(&concrete_data).await
- }
-// -- TEMPLATE END --
+>>>>>>>>>> renderer_match_arms
_ => {
return Err(CmdProcessError::Render(CmdRenderError::RendererNotFound(
renderer.to_string(),
)));
}
}
+
+@@@ >>> renderer_match_arms
+ "<<<name>>>" => {
+ <<<renderer_type>>>::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::<JVOutputType>() => {
+>>>>>>>>>> type_match_arms
+ _ => Err(CmdProcessError::NoMatchingCommand)
+}
+
+@@@ >>> type_match_arms
+ type_id if type_id == std::any::TypeId::of::<<<<jv_output_type>>>>() => {
let concrete_data = data
- .downcast::<JVOutputType>()
+ .downcast::<<<<jv_output_type>>>>()
.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::<OutputType>() => {
- RendererType::render(
- &data.downcast::<OutputType>()
- .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::<<<<output_type>>>>() => {
+ <<<renderer_type>>>::render(
+ &data.downcast::<<<<output_type>>>>()
+ .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: "<<<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(),
}
}
}
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 "<<<VERSION>>>"
-#define MyAppPublisher "<<<AUTHOR>>>"
-#define MyAppURL "<<<SITE>>>"
+#define MyAppVersion "<<<version>>>"
+#define MyAppPublisher "<<<author>>>"
+#define MyAppURL "<<<site>>>"
[Setup]
AppId={{8265DF21-F290-487E-9403-C2730EC31A03}