Skip to content

Commit

Permalink
feat: add concurrent working threads option to CLI args
Browse files Browse the repository at this point in the history
  • Loading branch information
ttys3 committed Nov 30, 2024
1 parent 8c32d2c commit 639ffbe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ pub struct CliArgs {
#[arg(short = 'p', long = "password", global = true)]
pub password: Option<OsString>,

/// cocurrent working threads
#[arg(short = 't', long, global = true)]
pub threads: Option<usize>,

// Ouch and claps subcommands
#[command(subcommand)]
pub cmd: Subcommand,
Expand Down
5 changes: 5 additions & 0 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 639ffbe

Please sign in to comment.