filetypes.rs
This file
The walk stopped after 200 commits: lines older than 86d6e2d point at it.
Merge pull request #1657 from sharkdp/dependabot/cargo/clap-4.5.23Tavian Barnesbefore adoption86d6e2d
lines 1–43why, one step back1use crate::dir_entry;2use crate::filesystem;34use faccess::PathExt;56/// Whether or not to show7#[derive(Default)]8pub struct FileTypes {9 pub files: bool,10 pub directories: bool,11 pub symlinks: bool,12 pub block_devices: bool,13 pub char_devices: bool,14 pub sockets: bool,15 pub pipes: bool,16 pub executables_only: bool,17 pub empty_only: bool,18}1920impl FileTypes {21 pub fn should_ignore(&self, entry: &dir_entry::DirEntry) -> bool {22 if let Some(ref entry_type) = entry.file_type() {23 (!self.files && entry_type.is_file())24 || (!self.directories && entry_type.is_dir())25 || (!self.symlinks && entry_type.is_symlink())26 || (!self.block_devices && filesystem::is_block_device(*entry_type))27 || (!self.char_devices && filesystem::is_char_device(*entry_type))28 || (!self.sockets && filesystem::is_socket(*entry_type))29 || (!self.pipes && filesystem::is_pipe(*entry_type))30 || (self.executables_only && !entry.path().executable())31 || (self.empty_only && !filesystem::is_empty(entry))32 || !(entry_type.is_file()33 || entry_type.is_dir()34 || entry_type.is_symlink()35 || filesystem::is_block_device(*entry_type)36 || filesystem::is_char_device(*entry_type)37 || filesystem::is_socket(*entry_type)38 || filesystem::is_pipe(*entry_type))39 } else {40 true41 }42 }43}