replace -N option with specifying '.' path

This commit is contained in:
Jonah Caplan 2021-10-11 19:15:15 -04:00
parent 08d913f167
commit 953f586f26
4 changed files with 12 additions and 27 deletions

View File

@ -12,8 +12,6 @@
- Add new `--no-ignore-parent` flag, see #787 (@will459)
- Add new `-N, --no-strip` flag, see #760 (@jcaplan)
## Bugfixes
- Set default path separator to `/` in MSYS, see #537 and #730 (@aswild)

View File

@ -615,17 +615,6 @@ pub fn build_app() -> App<'static, 'static> {
argument. Changes the usage to `fd [FLAGS/OPTIONS] --search-path <path> \
--search-path <path2> [<pattern>]`",
),
)
.arg(
Arg::with_name("no-strip")
.long("no-strip")
.short("N")
.conflicts_with_all(&["absolute-path", "list-details"])
.help("Show all non-absolute paths with './' prefix")
.long_help(
"Show all non-absolute paths with './' prefix. This flag only affects \
the output when no search path is provided.")
);
if cfg!(unix) {

View File

@ -375,8 +375,8 @@ fn construct_config(matches: clap::ArgMatches, pattern_regex: &str) -> Result<Co
None
}
}),
no_strip: matches.is_present("no-strip"),
})
no_strip: matches.is_present("path") || matches.is_present("search-path"),
})
}
fn extract_command(

View File

@ -1907,7 +1907,7 @@ fn test_error_if_hidden_not_set_and_pattern_starts_with_dot() {
fn test_no_strip() {
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
te.assert_output(
&["--no-strip"],
&[".", "."],
"./a.foo
./e1 e2
./one
@ -1922,19 +1922,17 @@ fn test_no_strip() {
);
te.assert_output(
&["--no-strip", "foo", "./one"],
"./one/b.foo
&["--search-path=."],
"./a.foo
./e1 e2
./one
./one/b.foo
./one/two
./one/two/c.foo
./one/two/C.Foo2
./one/two/three
./one/two/three/d.foo
./one/two/three/directory_foo",
);
te.assert_output(
&["--no-strip", "foo", "one"],
"one/b.foo
one/two/c.foo
one/two/C.Foo2
one/two/three/d.foo
one/two/three/directory_foo",
./one/two/three/directory_foo
./symlink",
);
}