mirror of
https://github.com/sharkdp/fd
synced 2024-10-02 22:13:31 +00:00
Improve --extension help text, closes #673
This commit is contained in:
parent
d205a7ff9e
commit
d2659de782
3
doc/fd.1
vendored
3
doc/fd.1
vendored
|
@ -145,6 +145,9 @@ This option can be used repeatedly to allow for multiple file types.
|
|||
Filter search results by file extension
|
||||
.IR ext .
|
||||
This option can be used repeatedly to allow for multiple possible file extensions.
|
||||
|
||||
If you want to search for files without extension, you can use the regex '^[^.]+$'
|
||||
as a normal search pattern.
|
||||
.TP
|
||||
.BI "\-E, \-\-exclude " pattern
|
||||
Exclude files/directories that match the given glob pattern.
|
||||
|
|
|
@ -279,7 +279,9 @@ pub fn build_app() -> App<'static, 'static> {
|
|||
.help("Filter by file extension")
|
||||
.long_help(
|
||||
"(Additionally) filter search results by their file extension. Multiple \
|
||||
allowable file extensions can be specified.",
|
||||
allowable file extensions can be specified.\n\
|
||||
If you want to search for files without extension, \
|
||||
you can use the regex '^[^.]+$' as a normal search pattern.",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
|
|
|
@ -1016,6 +1016,34 @@ fn test_extension() {
|
|||
te4.assert_output(&["--hidden", "--extension", ".hidden"], "test.hidden");
|
||||
}
|
||||
|
||||
/// No file extension (test for the pattern provided in the --help text)
|
||||
#[test]
|
||||
fn test_no_extension() {
|
||||
let te = TestEnv::new(
|
||||
DEFAULT_DIRS,
|
||||
&["a.foo", "aa", "one/b.foo", "one/bb", "one/two/three/d"],
|
||||
);
|
||||
|
||||
te.assert_output(
|
||||
&["^[^.]+$"],
|
||||
"aa
|
||||
one
|
||||
one/bb
|
||||
one/two
|
||||
one/two/three
|
||||
one/two/three/d
|
||||
one/two/three/directory_foo
|
||||
symlink",
|
||||
);
|
||||
|
||||
te.assert_output(
|
||||
&["^[^.]+$", "--type", "file"],
|
||||
"aa
|
||||
one/bb
|
||||
one/two/three/d",
|
||||
);
|
||||
}
|
||||
|
||||
/// Symlink as search directory
|
||||
#[test]
|
||||
fn test_symlink_as_root() {
|
||||
|
|
Loading…
Reference in a new issue