From 5e83cb09ef6b7aca47a18af1822f91d107f8f48c Mon Sep 17 00:00:00 2001 From: lashman Date: Fri, 6 Mar 2026 15:19:34 +0200 Subject: [PATCH] Add --algorithm and --overwrite flags to CLI Support resize algorithm selection (lanczos3/catmullrom/bilinear/nearest) and overwrite behavior (auto-rename/overwrite/skip) in the CLI process command, matching the GUI functionality. --- pixstrip-cli/src/main.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pixstrip-cli/src/main.rs b/pixstrip-cli/src/main.rs index 38a7cf3..4d86568 100644 --- a/pixstrip-cli/src/main.rs +++ b/pixstrip-cli/src/main.rs @@ -82,6 +82,14 @@ enum Commands { #[arg(long)] rename_template: Option, + /// Resize algorithm (lanczos3, catmullrom, bilinear, nearest) + #[arg(long, default_value = "lanczos3")] + algorithm: String, + + /// Overwrite behavior (auto-rename, overwrite, skip) + #[arg(long, default_value = "auto-rename")] + overwrite: String, + /// Include subdirectories #[arg(short, long)] recursive: bool, @@ -168,6 +176,8 @@ fn main() { rename_prefix, rename_suffix, rename_template, + algorithm, + overwrite, recursive, } => { cmd_process(CmdProcessArgs { @@ -186,6 +196,8 @@ fn main() { rename_prefix, rename_suffix, rename_template, + algorithm, + overwrite, recursive, }); } @@ -225,6 +237,8 @@ struct CmdProcessArgs { rename_prefix: Option, rename_suffix: Option, rename_template: Option, + algorithm: String, + overwrite: String, recursive: bool, } @@ -311,6 +325,19 @@ fn cmd_process(args: CmdProcessArgs) { }); } + job.resize_algorithm = match args.algorithm.to_lowercase().as_str() { + "catmullrom" | "catmull-rom" => ResizeAlgorithm::CatmullRom, + "bilinear" => ResizeAlgorithm::Bilinear, + "nearest" => ResizeAlgorithm::Nearest, + _ => ResizeAlgorithm::Lanczos3, + }; + + job.overwrite_behavior = match args.overwrite.to_lowercase().as_str() { + "overwrite" | "always" => OverwriteBehavior::Overwrite, + "skip" => OverwriteBehavior::Skip, + _ => OverwriteBehavior::AutoRename, + }; + for file in &source_files { job.add_source(file); }