mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-17 17:35:16 +01:00
changed executable=> executable_only
This commit is contained in:
parent
b1e48efc4a
commit
8ce127e443
3 changed files with 8 additions and 4 deletions
|
@ -22,7 +22,7 @@ pub struct FileTypes {
|
|||
pub files: bool,
|
||||
pub directories: bool,
|
||||
pub symlinks: bool,
|
||||
pub executables: bool,
|
||||
pub executables_only: bool,
|
||||
}
|
||||
|
||||
impl Default for FileTypes {
|
||||
|
@ -31,7 +31,7 @@ impl Default for FileTypes {
|
|||
files: false,
|
||||
directories: false,
|
||||
symlinks: false,
|
||||
executables: false,
|
||||
executables_only: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,10 @@ fn main() {
|
|||
"f" | "file" => file_types.files = true,
|
||||
"d" | "directory" => file_types.directories = true,
|
||||
"l" | "symlink" => file_types.symlinks = true,
|
||||
"x" | "executable" => file_types.executables = true,
|
||||
"x" | "executable" => {
|
||||
file_types.executables_only = true;
|
||||
file_types.files = true;
|
||||
},
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,12 +196,13 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<FdOptions>) {
|
|||
}
|
||||
|
||||
// Filter out unwanted file types.
|
||||
|
||||
if let Some(ref file_types) = config.file_types {
|
||||
if let Some(ref entry_type) = entry.file_type() {
|
||||
if (entry_type.is_file() && !file_types.files)
|
||||
|| (entry_type.is_dir() && !file_types.directories)
|
||||
|| (entry_type.is_symlink() && !file_types.symlinks)
|
||||
|| (output::is_executable(&entry.metadata().unwrap()) && !file_types.executables)
|
||||
|| (entry.metadata().is_ok() && !output::is_executable(&entry.metadata().unwrap()) && file_types.executables_only)
|
||||
{
|
||||
return ignore::WalkState::Continue;
|
||||
} else if !(entry_type.is_file() || entry_type.is_dir()
|
||||
|
|
Loading…
Reference in a new issue