aboutsummaryrefslogtreecommitdiff
path: root/core/src/data/game/cli
diff options
context:
space:
mode:
author1992414357@qq.com <1992414357@qq.com>2025-06-09 01:44:36 +0800
committer1992414357@qq.com <1992414357@qq.com>2025-06-09 01:44:36 +0800
commit49192dbb98e0ab1f2a66b4786fac86d63f69be64 (patch)
tree7cdf27c7cab5fb6b1aabc2ac7c44b7b492558945 /core/src/data/game/cli
parentc9dbba0d288becb7f05cebe526be25c76e5a850a (diff)
重构所有部分
Diffstat (limited to 'core/src/data/game/cli')
-rw-r--r--core/src/data/game/cli/cli_command.rs35
-rw-r--r--core/src/data/game/cli/mod.rs1
2 files changed, 36 insertions, 0 deletions
diff --git a/core/src/data/game/cli/cli_command.rs b/core/src/data/game/cli/cli_command.rs
new file mode 100644
index 0000000..1d79515
--- /dev/null
+++ b/core/src/data/game/cli/cli_command.rs
@@ -0,0 +1,35 @@
+use std::sync::{Arc, Mutex};
+use clap::{Parser, Subcommand};
+use nogamepads::entry_mutex;
+use crate::data::game::runtime::structs::GameRuntime;
+
+#[derive(Parser, Debug)]
+#[command(author, version, about, long_about = None)]
+pub struct GameCli {
+ #[command(subcommand)]
+ command: Commands,
+}
+
+#[derive(Subcommand, Debug)]
+enum Commands {
+
+ #[command(about = "Clean the screen")]
+ Clear,
+
+ #[command(about = "Close the game")]
+ Close
+}
+
+pub fn process_game_cli(runtime: Arc<Mutex<GameRuntime>>, cmd: GameCli) {
+ match cmd.command {
+ Commands::Clear => {
+
+ }
+
+ Commands::Close => {
+ entry_mutex!(runtime, |guard| {
+ guard.close_game();
+ })
+ }
+ }
+} \ No newline at end of file
diff --git a/core/src/data/game/cli/mod.rs b/core/src/data/game/cli/mod.rs
new file mode 100644
index 0000000..043f7b8
--- /dev/null
+++ b/core/src/data/game/cli/mod.rs
@@ -0,0 +1 @@
+pub mod cli_command; \ No newline at end of file