mirror of
https://github.com/egor-white/zaprett.git
synced 2025-12-15 15:59:50 +05:00
add args command and optimize binary
This commit is contained in:
@@ -30,3 +30,4 @@ panic = "abort"
|
|||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
lto = true
|
lto = true
|
||||||
strip = true
|
strip = true
|
||||||
|
codegen-units = 1
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
use crate::autostart::{get_autostart, set_autostart};
|
||||||
use crate::service::{restart_service, service_status, start_service, stop_service};
|
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 clap::Subcommand;
|
||||||
use log::error;
|
use log::error;
|
||||||
use crate::autostart::{get_autostart, set_autostart};
|
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
@@ -33,6 +33,12 @@ pub enum Command {
|
|||||||
|
|
||||||
/// Show the nfqws binary version
|
/// Show the nfqws binary version
|
||||||
BinaryVersion,
|
BinaryVersion,
|
||||||
|
|
||||||
|
/// Run nfqws
|
||||||
|
Args {
|
||||||
|
#[arg(allow_hyphen_values=true, trailing_var_arg = true, num_args = 0..)]
|
||||||
|
args: Vec<String>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Command {
|
impl Command {
|
||||||
@@ -61,6 +67,7 @@ impl Command {
|
|||||||
Command::GetAutostart => get_autostart(),
|
Command::GetAutostart => get_autostart(),
|
||||||
Command::ModuleVersion => println!("{}", module_version().await?),
|
Command::ModuleVersion => println!("{}", module_version().await?),
|
||||||
Command::BinaryVersion => println!("{}", bin_version()),
|
Command::BinaryVersion => println!("{}", bin_version()),
|
||||||
|
Command::Args { args } => run_nfqws(&args.join("")).unwrap(),
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user