mirror of
https://github.com/sharkdp/fd
synced 2024-11-05 16:58:21 +00:00
Adds path separator checking and hint for automatic /
expansion for some windows shells, eg., msys
This commit is contained in:
parent
ab81cad3b5
commit
693325bcf2
1 changed files with 12 additions and 0 deletions
12
src/main.rs
12
src/main.rs
|
@ -176,6 +176,18 @@ fn run() -> Result<ExitCode> {
|
|||
let path_separator = matches
|
||||
.value_of("path-separator")
|
||||
.map_or_else(filesystem::default_path_separator, |s| Some(s.to_owned()));
|
||||
if let Some(sep) = path_separator.clone() {
|
||||
if sep.len() > 1 {
|
||||
return Err(anyhow!(
|
||||
"A path separator must be exactly one byte, but \
|
||||
the given separator is {} bytes: {}\n\
|
||||
In some shells on Windows '/' is automatically \
|
||||
expanded. Use '//' instead.",
|
||||
sep.len(),
|
||||
sep
|
||||
));
|
||||
};
|
||||
};
|
||||
|
||||
let ls_colors = if colored_output {
|
||||
Some(LsColors::from_env().unwrap_or_else(|| LsColors::from_string(DEFAULT_LS_COLORS)))
|
||||
|
|
Loading…
Reference in a new issue