aboutsummaryrefslogtreecommitdiff
path: root/core/src/data/controller/cli
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/data/controller/cli')
-rw-r--r--core/src/data/controller/cli/cli_command.rs48
-rw-r--r--core/src/data/controller/cli/mod.rs1
2 files changed, 49 insertions, 0 deletions
diff --git a/core/src/data/controller/cli/cli_command.rs b/core/src/data/controller/cli/cli_command.rs
new file mode 100644
index 0000000..b5c0414
--- /dev/null
+++ b/core/src/data/controller/cli/cli_command.rs
@@ -0,0 +1,48 @@
+use std::sync::{Arc, Mutex};
+use clap::{Parser, Subcommand};
+use nogamepads::entry_mutex;
+use crate::data::controller::runtime::structs::ControllerRuntime;
+use crate::data::message::enums::ControlMessage;
+use crate::data::message::traits::MessageManager;
+use crate::service::service_types::ServiceType::TCPConnection;
+
+#[derive(Parser, Debug)]
+#[command(author, version, about, long_about = None)]
+pub struct ControllerCli {
+ #[command(subcommand)]
+ command: Commands,
+}
+
+#[derive(Subcommand, Debug)]
+enum Commands {
+
+ #[command(about = "Clean the screen")]
+ Clear,
+
+ #[command(about = "Send a message")]
+ Message,
+
+ #[command(about = "Close the controller")]
+ Close
+}
+
+pub fn process_controller_cli(runtime: Arc<Mutex<ControllerRuntime>>, cmd: ControllerCli) {
+
+ match cmd.command {
+ Commands::Clear => {
+
+ }
+
+ Commands::Message => {
+ entry_mutex!(runtime, |guard| {
+ guard.send(ControlMessage::Msg("fuck".to_string()), 0, TCPConnection);
+ });
+ }
+
+ Commands::Close => {
+ entry_mutex!(runtime, |guard| {
+ guard.close();
+ });
+ }
+ }
+} \ No newline at end of file
diff --git a/core/src/data/controller/cli/mod.rs b/core/src/data/controller/cli/mod.rs
new file mode 100644
index 0000000..043f7b8
--- /dev/null
+++ b/core/src/data/controller/cli/mod.rs
@@ -0,0 +1 @@
+pub mod cli_command; \ No newline at end of file