Enable --strip-cwd-prefix by default except with -0

Fixes #1046.
This commit is contained in:
Tavian Barnes 2022-09-21 12:36:38 -04:00 committed by David Peter
parent e46d402ed1
commit 4419401b6c
3 changed files with 331 additions and 343 deletions

View file

@ -719,10 +719,10 @@ pub fn build_app() -> Command<'static> {
.long("strip-cwd-prefix") .long("strip-cwd-prefix")
.conflicts_with_all(&["path", "search-path"]) .conflicts_with_all(&["path", "search-path"])
.hide_short_help(true) .hide_short_help(true)
.help("strip './' prefix from non-tty outputs") .help("strip './' prefix from -0/--print0 output")
.long_help( .long_help(
"By default, relative paths are prefixed with './' when the output goes to a non \ "By default, relative paths are prefixed with './' when -0/--print0 is given, to \
interactive terminal (TTY). Use this flag to disable this behaviour." make them safer for use with xargs. Use this flag to disable this behaviour."
) )
); );

View file

@ -385,7 +385,7 @@ fn construct_config(matches: clap::ArgMatches, pattern_regex: &str) -> Result<Co
}), }),
strip_cwd_prefix: (!matches.is_present("path") strip_cwd_prefix: (!matches.is_present("path")
&& !matches.is_present("search-path") && !matches.is_present("search-path")
&& (interactive_terminal || matches.is_present("strip-cwd-prefix"))), && (!matches.is_present("null_separator") || matches.is_present("strip-cwd-prefix"))),
}) })
} }

File diff suppressed because it is too large Load diff