From 6a3c6496fc2e707fe3e846469e2474d7a178e84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marcos?= Date: Tue, 15 Jul 2025 16:53:55 -0300 Subject: [PATCH 1/3] Rename `--threads` to `--concurrency` And add alias to previous name --- src/cli/args.rs | 8 ++++---- src/commands/mod.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cli/args.rs b/src/cli/args.rs index b756df5..68e3854 100644 --- a/src/cli/args.rs +++ b/src/cli/args.rs @@ -45,9 +45,9 @@ pub struct CliArgs { #[arg(short = 'p', long = "password", 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() From e83c1a62ce0d61c9f011961d4bd28435da83e737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marcos?= Date: Tue, 15 Jul 2025 16:57:32 -0300 Subject: [PATCH 2/3] changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3062d1f..89e65ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,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) From 8227082ac55108ee743280ddce1b74267c605f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marcos?= Date: Tue, 15 Jul 2025 17:01:11 -0300 Subject: [PATCH 3/3] update UI tests --- .../ui__ui_test_usage_help_flag-2.snap | 23 +++++++++---------- .../ui__ui_test_usage_help_flag.snap | 7 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) 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')