From 8646a3eab52c2b299304d3dfc142a358c74b0697 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Wed, 22 Jul 2026 01:55:17 +0800 Subject: feat(mingling_cli): add wrapper binary and optimize release profile Add `mling` wrapper binary that delegates to `mingling-cli`, enabling separate binary names while maintaining Cargo conventions. --- mingling_cli/src/bin/wrapper.rs | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 mingling_cli/src/bin/wrapper.rs (limited to 'mingling_cli/src') diff --git a/mingling_cli/src/bin/wrapper.rs b/mingling_cli/src/bin/wrapper.rs new file mode 100644 index 0000000..b1aecf6 --- /dev/null +++ b/mingling_cli/src/bin/wrapper.rs @@ -0,0 +1,47 @@ +use std::env; +use std::ffi::OsString; +use std::path::PathBuf; +use std::process::{self, Command}; + +fn main() { + exec(); +} + +fn exec() { + fn target_exe_path() -> PathBuf { + let mut path = env::current_exe().expect("Fail to read current_exe"); + path.pop(); + + let target_name = if cfg!(target_os = "windows") { + "mingling-cli.exe" + } else { + "mingling-cli" + }; + + path.push(target_name); + path + } + + let mut args: Vec = env::args_os().collect(); + let pass_args = if args.len() > 1 { + args.split_off(1) + } else { + vec![] + }; + + let target = target_exe_path(); + + let status = Command::new(&target) + .args(&pass_args) + .status() + .unwrap_or_else(|_| { + process::exit(1); + }); + + match status.code() { + Some(code) => process::exit(code), + None => { + process::exit(1); + } + } +} -- cgit