Skip to content
Myr

Merge pull request #1394 from final-israel/make_max_results_one_conflict_with_exec

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Making `-1` conflict with `--exec` and making `max-results` override `-1`

authored by Thayne McCombs · committed by GitHub · parents 93cdb26, dea9110 · Browse files · 2 files+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−1 removed

  • tests:+5 added−0 removed
  • other:+2 added−1 removed

2 files+7 added−1 removed

modified:src/cli.rs+2 added-1 removed
24 unmodified lines
25 after_long_help = "Bugs can be reported on GitHub: https://github.com/sharkdp/fd/issues",26 max_term_width = 98,27 args_override_self = true,28 group(ArgGroup::new("execs").args(&["exec", "exec_batch", "list_details"]).conflicts_with_all(&[29 "max_results", "has_results", "count"])),29 "max_results", "has_results", "count", "max_one_result"])),30)]31pub struct Opts {32 /// Include hidden directories and files in the search results (default:33 /// hidden files and directories are skipped). Files and directories are
470 unmodified lines
504 #[arg(505 long,506 value_name = "count",507 hide_short_help = true,508 overrides_with("max_one_result"),509 help = "Limit the number of search results",510 long_help511 )]512 max_results: Option<usize>,
350 unmodified lines
modified:tests/tests.rs+5 added
2382 unmodified lines
2383 assert!(stdout == "one/two/C.Foo2" || stdout == "one/two/c.foo");2384 };2385 assert_just_one_result_with_option("--max-results=1");2386 assert_just_one_result_with_option("-1");23872388 // check that --max-results & -1 conflic with --exec2389 te.assert_failure(&["thing", "--max-results=0", "--exec=cat"]);2390 te.assert_failure(&["thing", "-1", "--exec=cat"]);2391 te.assert_failure(&["thing", "--max-results=1", "-1", "--exec=cat"]);2392}23932394/// Filenames with non-utf8 paths are passed to the executed program unchanged2395///
161 unmodified lines