Skip to content
Myr

Improve --extension help text, closes #673

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

authored by sharkdp · committed by sharkdp · parent d205a7f · Browse files · 3 files+34 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

3 files+34 added−1 removed

  • tests:+28 added−0 removed
  • other:+6 added−1 removed

3 files+34 added−1 removed

modified:doc/fd.1+3 added
143 unmodified lines
144.BI "\-e, \-\-extension " ext145Filter search results by file extension146.IR ext .147This option can be used repeatedly to allow for multiple possible file extensions.148149If you want to search for files without extension, you can use the regex '^[^.]+$'150as a normal search pattern.151.TP152.BI "\-E, \-\-exclude " pattern153Exclude files/directories that match the given glob pattern.154This overrides any other ignore logic.
178 unmodified lines
modified:src/app.rs+3 added-1 removed
277 unmodified lines
278 .value_name("ext")279 .help("Filter by file extension")280 .long_help(281 "(Additionally) filter search results by their file extension. Multiple \282 allowable file extensions can be specified.",282 allowable file extensions can be specified.\n\283 If you want to search for files without extension, \284 you can use the regex '^[^.]+$' as a normal search pattern.",285 ),286 )287 .arg(288 Arg::with_name("exec")
305 unmodified lines
modified:tests/tests.rs+28 added
1014 unmodified lines
10151016 te4.assert_output(&["--hidden", "--extension", ".hidden"], "test.hidden");1017}10181019/// No file extension (test for the pattern provided in the --help text)1020#[test]1021fn test_no_extension() {1022 let te = TestEnv::new(1023 DEFAULT_DIRS,1024 &["a.foo", "aa", "one/b.foo", "one/bb", "one/two/three/d"],1025 );10261027 te.assert_output(1028 &["^[^.]+$"],1029 "aa1030 one1031 one/bb1032 one/two1033 one/two/three1034 one/two/three/d1035 one/two/three/directory_foo1036 symlink",1037 );10381039 te.assert_output(1040 &["^[^.]+$", "--type", "file"],1041 "aa1042 one/bb1043 one/two/three/d",1044 );1045}10461047/// Symlink as search directory1048#[test]1049fn test_symlink_as_root() {1050 let mut te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
651 unmodified lines