add args command and optimize binary

This commit is contained in:
CherretGit
2025-11-11 20:48:21 +07:00
parent ac35be8e57
commit 277f6756bd
2 changed files with 10 additions and 2 deletions

View File

@@ -30,3 +30,4 @@ panic = "abort"
opt-level = "z"
lto = true
strip = true
codegen-units = 1

View File

@@ -1,8 +1,8 @@
use crate::autostart::{get_autostart, set_autostart};
use crate::service::{restart_service, service_status, start_service, stop_service};
use crate::{bin_version, module_version};
use crate::{bin_version, module_version, run_nfqws};
use clap::Subcommand;
use log::error;
use crate::autostart::{get_autostart, set_autostart};
#[derive(Subcommand)]
pub enum Command {
@@ -33,6 +33,12 @@ pub enum Command {
/// Show the nfqws binary version
BinaryVersion,
/// Run nfqws
Args {
#[arg(allow_hyphen_values=true, trailing_var_arg = true, num_args = 0..)]
args: Vec<String>,
},
}
impl Command {
@@ -61,6 +67,7 @@ impl Command {
Command::GetAutostart => get_autostart(),
Command::ModuleVersion => println!("{}", module_version().await?),
Command::BinaryVersion => println!("{}", bin_version()),
Command::Args { args } => run_nfqws(&args.join("")).unwrap(),
}
Ok(())