mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-25 21:37:33 +00:00
Highlight link number for files with multiple links
Curiously enough, this turned out to be helpful today... Git can't traverse symlinks, so I had to use hard links instead, and then I had to work out which files had more than one link at a glance. If I hadn't already had most of exa written, I'd be stuck using find!
This commit is contained in:
parent
55280a5308
commit
baf9f9572f
@ -36,7 +36,7 @@ impl Colour {
|
|||||||
Black => "40".to_string(),
|
Black => "40".to_string(),
|
||||||
Red => "41".to_string(),
|
Red => "41".to_string(),
|
||||||
Green => "42".to_string(),
|
Green => "42".to_string(),
|
||||||
Yellow => "44".to_string(),
|
Yellow => "43".to_string(),
|
||||||
Blue => "44".to_string(),
|
Blue => "44".to_string(),
|
||||||
Purple => "45".to_string(),
|
Purple => "45".to_string(),
|
||||||
Cyan => "46".to_string(),
|
Cyan => "46".to_string(),
|
||||||
|
10
file.rs
10
file.rs
@ -94,7 +94,15 @@ impl<'a> File<'a> {
|
|||||||
Permissions => self.permissions_string(),
|
Permissions => self.permissions_string(),
|
||||||
FileName => self.file_name(),
|
FileName => self.file_name(),
|
||||||
FileSize(use_iec) => self.file_size(use_iec),
|
FileSize(use_iec) => self.file_size(use_iec),
|
||||||
HardLinks => Red.paint(self.stat.unstable.nlink.to_str().as_slice()),
|
|
||||||
|
// A file with multiple links is interesting, but
|
||||||
|
// directories and suchlike can have multiple links all
|
||||||
|
// the time.
|
||||||
|
HardLinks => {
|
||||||
|
let style = if self.stat.kind == io::TypeFile && self.stat.unstable.nlink > 1 { Red.on(Yellow) } else { Red.normal() };
|
||||||
|
style.paint(self.stat.unstable.nlink.to_str().as_slice())
|
||||||
|
},
|
||||||
|
|
||||||
Inode => Purple.paint(self.stat.unstable.inode.to_str().as_slice()),
|
Inode => Purple.paint(self.stat.unstable.inode.to_str().as_slice()),
|
||||||
Blocks => {
|
Blocks => {
|
||||||
if self.stat.kind == io::TypeFile || self.stat.kind == io::TypeSymlink {
|
if self.stat.kind == io::TypeFile || self.stat.kind == io::TypeSymlink {
|
||||||
|
Loading…
Reference in New Issue
Block a user