mirror of
https://github.com/egor-white/zaprett.git
synced 2025-12-10 05:19:42 +05:00
Add zapret binary version
This commit is contained in:
5
rust/crates/zaprett/build.rs
Normal file
5
rust/crates/zaprett/build.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
use std::env;
|
||||
fn main() {
|
||||
let zapret_version = env::var("ZAPRET_VERSION").unwrap_or("unknown".to_string());
|
||||
println!("cargo:rustc-env=ZAPRET_VERSION={}", zapret_version);
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
extern crate nix;
|
||||
|
||||
use anyhow::bail;
|
||||
use clap::{ArgAction, Parser, Subcommand, builder::BoolishValueParser};
|
||||
use daemonize::Daemonize;
|
||||
@@ -57,6 +55,9 @@ enum Commands {
|
||||
|
||||
#[clap(about = "Get module version")]
|
||||
ModuleVer,
|
||||
|
||||
#[clap(about = "Get nfqws binary version")]
|
||||
BinVer,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
@@ -114,6 +115,10 @@ async fn main() -> anyhow::Result<()> {
|
||||
module_version();
|
||||
Ok(())
|
||||
}
|
||||
Some(Commands::BinVer) => {
|
||||
bin_version();
|
||||
Ok(())
|
||||
}
|
||||
None => {
|
||||
println!("zaprett installed. Join us: t.me/zaprett_module");
|
||||
Ok(())
|
||||
@@ -317,22 +322,9 @@ fn module_version() {
|
||||
}
|
||||
}
|
||||
|
||||
/*fn bin_version() {
|
||||
todo!()
|
||||
/*if let Ok(output) = Command::new("nfqws").arg("--version").output() {
|
||||
if output.status.success() {
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
if let Ok(re) = Regex::new(r"version v[0-9.]+") {
|
||||
if let Some(m) = re.find(&stdout) {
|
||||
if let Some(v) = m.as_str().split_whitespace().nth(1) {
|
||||
println!("{}", v);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}*/
|
||||
fn bin_version() {
|
||||
println!("{}", env!("ZAPRET_VERSION"));
|
||||
}
|
||||
fn merge_files(
|
||||
input_paths: Vec<String>,
|
||||
output_path: &Path,
|
||||
|
||||
Reference in New Issue
Block a user