Skip to content
Myr

filetypes.rs

This file

Path

src/filetypes.rs

43 lines · 1.5 KiB · Rust

Last changed by

Support character and block device file typesChristian Göttschebefore adoption36bc840

History of this file

Take it

The walk stopped after 200 commits: lines older than 17d849d point at it.

Compute colors in parallelTavian Barnesbefore adoption17d849d

lines 1–3why, one step back
1use crate::dir_entry;
2use crate::filesystem;3

Merge pull request #1169 from Ptipiak/mention-executable-detectionDavid Peterbefore adoption38cdeb0

lines 4–5why, one step back
4use faccess::PathExt;
5

Compute colors in parallelTavian Barnesbefore adoption17d849d

lines 6–11why, one step back
6/// Whether or not to show
7#[derive(Default)]8pub struct FileTypes {9 pub files: bool,10 pub directories: bool,11 pub symlinks: bool,

Support character and block device file typesChristian Göttschebefore adoption36bc840

lines 12–13why, one step back
12 pub block_devices: bool,
13 pub char_devices: bool,

Compute colors in parallelTavian Barnesbefore adoption17d849d

lines 14–25why, one step back
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())

Support character and block device file typesChristian Göttschebefore adoption36bc840

lines 26–27why, one step back
26 || (!self.block_devices && filesystem::is_block_device(*entry_type))
27 || (!self.char_devices && filesystem::is_char_device(*entry_type))

Compute colors in parallelTavian Barnesbefore adoption17d849d

lines 28–29why, one step back
28 || (!self.sockets && filesystem::is_socket(*entry_type))
29 || (!self.pipes && filesystem::is_pipe(*entry_type))

Merge pull request #1169 from Ptipiak/mention-executable-detectionDavid Peterbefore adoption38cdeb0

line 30why, one step back
30 || (self.executables_only && !entry.path().executable())

Compute colors in parallelTavian Barnesbefore adoption17d849d

lines 31–34why, one step back
31 || (self.empty_only && !filesystem::is_empty(entry))
32 || !(entry_type.is_file()33 || entry_type.is_dir()34 || entry_type.is_symlink()

Support character and block device file typesChristian Göttschebefore adoption36bc840

lines 35–36why, one step back
35 || filesystem::is_block_device(*entry_type)
36 || filesystem::is_char_device(*entry_type)

Compute colors in parallelTavian Barnesbefore adoption17d849d

lines 37–43why, one step back
37 || filesystem::is_socket(*entry_type)
38 || filesystem::is_pipe(*entry_type))39 } else {40 true41 }42 }43}