diff --git a/CHANGELOG.md b/CHANGELOG.md index f4b20ad..83111e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Categories Used: ### Tweaks - Make `.bz3` opt-out [\#814](https://github.com/ouch-org/ouch/pull/814) ([amyspark](https://github.com/amyspark)) +- Add alias `--concurrency` to `--threads` flag (then swap alias with original) [\#848](https://github.com/ouch-org/ouch/pull/848) ([marcospb19](https://github.com/marcospb19)) ## [0.6.1](https://github.com/ouch-org/ouch/compare/0.6.0...0.6.1) diff --git a/src/cli/args.rs b/src/cli/args.rs index 105f004..d50d4a1 100644 --- a/src/cli/args.rs +++ b/src/cli/args.rs @@ -45,9 +45,9 @@ pub struct CliArgs { #[arg(short, long = "password", aliases = ["pass", "pw"], global = true)] pub password: Option, - /// Concurrent working threads - #[arg(short = 'c', long, global = true)] - pub threads: Option, + /// Limit the amount of concurrent threads available + #[arg(short, long, visible_alias = "threads", global = true)] + pub concurrency: Option, // Ouch and claps subcommands #[command(subcommand)] @@ -154,7 +154,7 @@ mod tests { format: None, // This is usually replaced in assertion tests password: None, - threads: None, + concurrency: None, cmd: Subcommand::Decompress { // Put a crazy value here so no test can assert it unintentionally files: vec!["\x00\x11\x22".into()], diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 4a81d85..7204328 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -54,7 +54,7 @@ pub fn run( question_policy: QuestionPolicy, file_visibility_policy: FileVisibilityPolicy, ) -> crate::Result<()> { - if let Some(threads) = args.threads { + if let Some(threads) = args.concurrency { rayon::ThreadPoolBuilder::new() .num_threads(threads) .build_global() diff --git a/tests/snapshots/ui__ui_test_usage_help_flag-2.snap b/tests/snapshots/ui__ui_test_usage_help_flag-2.snap index 75a873e..2ae83ec 100644 --- a/tests/snapshots/ui__ui_test_usage_help_flag-2.snap +++ b/tests/snapshots/ui__ui_test_usage_help_flag-2.snap @@ -1,7 +1,6 @@ --- source: tests/ui.rs expression: "output_to_string(ouch!(\"-h\"))" -snapshot_kind: text --- A command-line utility for easily compressing and decompressing files and directories. @@ -14,14 +13,14 @@ Commands: help Print this message or the help of the given subcommand(s) Options: - -y, --yes Skip [Y/n] questions, default to yes - -n, --no Skip [Y/n] questions, default to no - -A, --accessible Activate accessibility mode, reducing visual noise [env: ACCESSIBLE=] - -H, --hidden Ignore hidden files - -q, --quiet Silence output - -g, --gitignore Ignore files matched by git's ignore files - -f, --format Specify the format of the archive - -p, --password Decompress or list with password - -c, --threads Concurrent working threads - -h, --help Print help (see more with '--help') - -V, --version Print version + -y, --yes Skip [Y/n] questions, default to yes + -n, --no Skip [Y/n] questions, default to no + -A, --accessible Activate accessibility mode, reducing visual noise [env: ACCESSIBLE=] + -H, --hidden Ignore hidden files + -q, --quiet Silence output + -g, --gitignore Ignore files matched by git's ignore files + -f, --format Specify the format of the archive + -p, --password Decompress or list with password + -c, --concurrency Limit the amount of concurrent threads available [aliases: threads] + -h, --help Print help (see more with '--help') + -V, --version Print version diff --git a/tests/snapshots/ui__ui_test_usage_help_flag.snap b/tests/snapshots/ui__ui_test_usage_help_flag.snap index 9f3f8db..e0fe03f 100644 --- a/tests/snapshots/ui__ui_test_usage_help_flag.snap +++ b/tests/snapshots/ui__ui_test_usage_help_flag.snap @@ -1,7 +1,6 @@ --- source: tests/ui.rs expression: "output_to_string(ouch!(\"--help\"))" -snapshot_kind: text --- A command-line utility for easily compressing and decompressing files and directories. @@ -44,8 +43,10 @@ Options: -p, --password Decompress or list with password - -c, --threads - Concurrent working threads + -c, --concurrency + Limit the amount of concurrent threads available + + [aliases: threads] -h, --help Print help (see a summary with '-h')