mirror of
https://github.com/sharkdp/fd
synced 2024-07-05 17:29: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
|
Filter search results by file extension
|
||||||
.IR ext .
|
.IR ext .
|
||||||
This option can be used repeatedly to allow for multiple possible file extensions.
|
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
|
.TP
|
||||||
.BI "\-E, \-\-exclude " pattern
|
.BI "\-E, \-\-exclude " pattern
|
||||||
Exclude files/directories that match the given glob 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")
|
.help("Filter by file extension")
|
||||||
.long_help(
|
.long_help(
|
||||||
"(Additionally) filter search results by their file extension. Multiple \
|
"(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(
|
.arg(
|
||||||
|
|
|
@ -1016,6 +1016,34 @@ fn test_extension() {
|
||||||
te4.assert_output(&["--hidden", "--extension", ".hidden"], "test.hidden");
|
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
|
/// Symlink as search directory
|
||||||
#[test]
|
#[test]
|
||||||
fn test_symlink_as_root() {
|
fn test_symlink_as_root() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user