mirror of
https://github.com/Llewellynvdm/exa.git
synced 2025-02-02 10:38:24 +00:00
Do similar for block devices and named pipes
There doesn't seem to be an io::FileType entry for character special devices or sockets, so these fall under the io::UnknownType entry. Which also gets highlighted in yellow, for precisely that reason.
This commit is contained in:
parent
a542fdc9f9
commit
eff87440fa
2
file.rs
2
file.rs
@ -145,7 +145,7 @@ impl<'a> File<'a> {
|
||||
io::TypeNamedPipe => Yellow.paint("|"),
|
||||
io::TypeBlockSpecial => Purple.paint("s"),
|
||||
io::TypeSymlink => Cyan.paint("l"),
|
||||
_ => "?".to_string(),
|
||||
io::TypeUnknown => "?".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ use file::File;
|
||||
use std::io;
|
||||
|
||||
pub enum FileType {
|
||||
Normal, Directory, Executable, Immediate, Compiled, Symlink,
|
||||
Normal, Directory, Executable, Immediate, Compiled, Symlink, Special,
|
||||
Image, Video, Music, Lossless, Compressed, Document, Temp, Crypto,
|
||||
}
|
||||
|
||||
@ -46,6 +46,7 @@ impl FileType {
|
||||
Normal => Plain,
|
||||
Directory => Blue.bold(),
|
||||
Symlink => Cyan.normal(),
|
||||
Special => Yellow.normal(),
|
||||
Executable => Green.bold(),
|
||||
Image => Fixed(133).normal(),
|
||||
Video => Fixed(135).normal(),
|
||||
@ -73,6 +74,9 @@ impl<'a> HasType for File<'a> {
|
||||
else if self.stat.kind == io::TypeSymlink {
|
||||
return Symlink;
|
||||
}
|
||||
else if self.stat.kind == io::TypeBlockSpecial || self.stat.kind == io::TypeNamedPipe || self.stat.kind == io::TypeUnknown {
|
||||
return Special;
|
||||
}
|
||||
else if self.stat.perm.contains(io::UserExecute) {
|
||||
return Executable;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user