aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-09 01:14:19 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-09 01:17:21 +0800
commitcde7be4e67aea4378fbac8462ba8fff48b73ea1e (patch)
tree2740f295a797bce72ad5c6e69bf77a5997568a85
parentdfbc80098c2b46adb14a571947fb7ac8f0169224 (diff)
feat(tscn-to-bsn): add global help fallback support
Add a fallback module providing a help command that displays usage information for the tool.
-rw-r--r--tools/tscn-to-bsn/src/bin/tscn2bsn.rs2
-rw-r--r--tools/tscn-to-bsn/src/fallback.rs13
-rw-r--r--tools/tscn-to-bsn/src/helps/help.txt15
-rw-r--r--tools/tscn-to-bsn/src/lib.rs1
4 files changed, 31 insertions, 0 deletions
diff --git a/tools/tscn-to-bsn/src/bin/tscn2bsn.rs b/tools/tscn-to-bsn/src/bin/tscn2bsn.rs
index 4ac1f5a..84d6444 100644
--- a/tools/tscn-to-bsn/src/bin/tscn2bsn.rs
+++ b/tools/tscn-to-bsn/src/bin/tscn2bsn.rs
@@ -1,4 +1,5 @@
use mingling::picker::parselib::{ParserStyle, WINDOWS_STYLE};
+use mingling::setup::picker::HelpFlagSetup;
use tscn_to_bsn::ThisProgram;
use tscn_to_bsn::cmd::CommandsSetup;
use tscn_to_bsn::res::gd_proj_dir::GodotProjectSetup;
@@ -8,6 +9,7 @@ fn main() {
ParserStyle::set_global_style(&WINDOWS_STYLE);
+ program.with_setup(HelpFlagSetup::default());
program.with_setup(CommandsSetup);
program.with_setup(GodotProjectSetup);
diff --git a/tools/tscn-to-bsn/src/fallback.rs b/tools/tscn-to-bsn/src/fallback.rs
new file mode 100644
index 0000000..99bdd13
--- /dev/null
+++ b/tools/tscn-to-bsn/src/fallback.rs
@@ -0,0 +1,13 @@
+use mingling::macros::{help, renderer};
+
+use crate::EntryFallback;
+
+#[help]
+pub fn help_global(_: EntryFallback) -> String {
+ include_str!("helps/help.txt").to_string()
+}
+
+#[renderer]
+pub fn render_global_hint(_: EntryFallback) -> String {
+ "Error: unknown command, please use `tscn2bsn /H` for help".into()
+}
diff --git a/tools/tscn-to-bsn/src/helps/help.txt b/tools/tscn-to-bsn/src/helps/help.txt
new file mode 100644
index 0000000..3f9c7c2
--- /dev/null
+++ b/tools/tscn-to-bsn/src/helps/help.txt
@@ -0,0 +1,15 @@
+A simple program for translating Godot 4's TSCN (*.tscn) files
+ into Bevy 0.19's bsn! macro invocation code.
+
+USAGE: tscn2bsn [] <ARGS..>
+
+Flags:
+ /H /Help Show this text
+ /P /ProjectPath <DIR_PATH> Godot project path
+
+Commands:
+ convert /I <TSCN_FILE> /O <RON_FILE> Parse TSCN text into a syntax tree and
+ output it to a RON file.
+
+ build-cache Collect information about the current
+ project and build a cache for analysis.
diff --git a/tools/tscn-to-bsn/src/lib.rs b/tools/tscn-to-bsn/src/lib.rs
index d243e10..b2d80aa 100644
--- a/tools/tscn-to-bsn/src/lib.rs
+++ b/tools/tscn-to-bsn/src/lib.rs
@@ -2,6 +2,7 @@ use mingling::macros::gen_program;
pub mod cmd;
pub mod err;
+pub mod fallback;
pub mod gd_res_structure;
pub mod res;