From 1b12ecc67f0fdc21512103ac926babf4869fe842 Mon Sep 17 00:00:00 2001 From: prplV Date: Wed, 4 Dec 2024 12:55:26 +0300 Subject: [PATCH] critical bug in files fixed + cli created --- noxis-cli/Cargo.toml | 1 + noxis-cli/src/cli.rs | 14 ++++++++++++++ noxis-cli/src/main.rs | 2 ++ noxis-rs/src/utils/files.rs | 5 ++++- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 noxis-cli/src/cli.rs diff --git a/noxis-cli/Cargo.toml b/noxis-cli/Cargo.toml index bbc575a..338cfa3 100644 --- a/noxis-cli/Cargo.toml +++ b/noxis-cli/Cargo.toml @@ -4,3 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies] +clap = { version = "4.5.22", features = ["derive"] } diff --git a/noxis-cli/src/cli.rs b/noxis-cli/src/cli.rs new file mode 100644 index 0000000..43c367c --- /dev/null +++ b/noxis-cli/src/cli.rs @@ -0,0 +1,14 @@ +use clap::{Parser, Subcommand}; + +#[derive(Debug, Parser)] +pub struct Cli { + #[command( + subcommand, + help = "status|start|stop|restart|", + )] + command : Commands, +} +#[derive(Debug, Subcommand)] +pub enum Commands { + +} \ No newline at end of file diff --git a/noxis-cli/src/main.rs b/noxis-cli/src/main.rs index e7a11a9..1e43e50 100644 --- a/noxis-cli/src/main.rs +++ b/noxis-cli/src/main.rs @@ -1,3 +1,5 @@ +mod cli; + fn main() { println!("Hello, world!"); } diff --git a/noxis-rs/src/utils/files.rs b/noxis-rs/src/utils/files.rs index 515aaa1..28346c2 100644 --- a/noxis-rs/src/utils/files.rs +++ b/noxis-rs/src/utils/files.rs @@ -98,7 +98,10 @@ pub async fn file_handler( // * watcher recreation after dealing with file recreation mechanism in text editors let mutex = notify.borrow_mut(); - *mutex = create_watcher(&file.filename, &file.src).await.unwrap(); + // *mutex = create_watcher(&file.filename, &file.src).await.unwrap(); + if let Ok(watcher) = create_watcher(&file.filename, &file.src).await { + *mutex = watcher; + } } match file.triggers.on_change.as_str() { "stop" => {