diff --git a/cutPic/Cargo.toml b/cutPic/Cargo.toml index 3394dc0..8273980 100644 --- a/cutPic/Cargo.toml +++ b/cutPic/Cargo.toml @@ -2,6 +2,7 @@ name = "cutpic" version = "0.1.0" edition = "2024" +publish = ["gitea"] [dependencies] image = "0.25" diff --git a/dexcel/Cargo.toml b/dexcel/Cargo.toml index 0c80b0b..9838acc 100644 --- a/dexcel/Cargo.toml +++ b/dexcel/Cargo.toml @@ -2,6 +2,7 @@ name = "dexcel" version = "0.4.0" edition = "2021" +publish = ["gitea"] [dependencies] chrono = "0.4" diff --git a/ptm/Cargo.toml b/ptm/Cargo.toml index 2b06b90..1dbafdb 100644 --- a/ptm/Cargo.toml +++ b/ptm/Cargo.toml @@ -2,6 +2,7 @@ name = "ptm" version = "0.1.0" edition = "2021" +publish = ["gitea"] [dependencies] clap = { version = "4.6", features = ["derive"] } diff --git a/zip/Cargo.toml b/zip/Cargo.toml index bdec47c..8ae8066 100644 --- a/zip/Cargo.toml +++ b/zip/Cargo.toml @@ -2,6 +2,7 @@ name = "zip" version = "0.1.1" edition = "2024" +publish = ["gitea"] [dependencies] clap = { version = "4.5", features = ["derive"] } @@ -10,3 +11,4 @@ walkdir = "2.5" arboard = "3.4" clipboard-win = "5.4" winapi = { version = "0.3", features = ["winuser"] } +notify-rust = "4" diff --git a/zip/src/main.rs b/zip/src/main.rs index 57625e9..2ae3991 100644 --- a/zip/src/main.rs +++ b/zip/src/main.rs @@ -25,6 +25,10 @@ struct Args { /// 📋 复制 zip 文件路径到剪切板 #[arg(short = 'v', long = "clipboard")] clipboard: bool, + + /// 💬 弹出 Windows 通知提示打包完成 + #[arg(short = 't', long = "tip", value_name = "MESSAGE", num_args = 0..=1, default_missing_value = "")] + tip: Option, } fn main() -> Result<(), Box> { @@ -40,7 +44,12 @@ fn main() -> Result<(), Box> { // 生成输出文件名 let output_path = if let Some(name) = &args.name { - name.clone() + let name_str = name.to_string_lossy().to_string(); + if name_str.to_lowercase().ends_with(".zip") { + name.clone() + } else { + PathBuf::from(format!("{}.zip", name_str)) + } } else { // 根据第一个源文件/文件夹生成默认名称 let first_source = &args.sources[0]; @@ -170,6 +179,32 @@ fn main() -> Result<(), Box> { } } + // 如果需要弹出 Windows 通知 + if let Some(tip_message) = &args.tip { + use notify_rust::Notification; + + let title = "打包完成"; + let mut body = if tip_message.is_empty() { + let file_name = output_path.file_name().unwrap_or_default().to_string_lossy().to_string(); + format!("{} 已经打包好了", file_name) + } else { + tip_message.clone() + }; + + if args.clipboard { + body.push_str("\n已经复制到剪贴板"); + } + + match Notification::new() + .summary(title) + .body(&body) + .show() + { + Ok(_) => {} + Err(e) => eprintln!("⚠️ 发送通知失败: {}", e), + } + } + println!(); Ok(()) }