diff --git a/src/cli/args.rs b/src/cli/args.rs index 05b522c6..3dddd533 100644 --- a/src/cli/args.rs +++ b/src/cli/args.rs @@ -45,6 +45,10 @@ pub struct CliArgs { #[arg(short = 'p', long = "password", global = true)] pub password: Option, + /// cocurrent working threads + #[arg(short = 't', long, global = true)] + pub threads: Option, + // Ouch and claps subcommands #[command(subcommand)] pub cmd: Subcommand, diff --git a/src/cli/mod.rs b/src/cli/mod.rs index ce6b5d59..8d38b447 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -28,6 +28,11 @@ impl CliArgs { set_accessible(args.accessible); + rayon::ThreadPoolBuilder::new() + .num_threads(args.threads.unwrap_or(0)) + .build_global() + .unwrap(); + let (Subcommand::Compress { files, .. } | Subcommand::Decompress { files, .. } | Subcommand::List { archives: files, .. }) = &mut args.cmd;