diff options
author | zwPapEr <zw.paper@gmail.com> | 2019-12-12 12:17:02 +0800 |
---|---|---|
committer | Abin Simon <abinsimon10@gmail.com> | 2020-01-11 14:17:44 +0530 |
commit | 37a97353a1a7035d2a2f7de888bd7c97849a4a9d (patch) | |
tree | 6af667ea696a9b7d2fad60df997157b3eab2c387 | |
parent | da2e2081e3b242ad69ae41d2663e7b60e261a022 (diff) |
inode: :hammer: using - for not supported windows inode
-rw-r--r-- | src/app.rs | 1 | ||||
-rw-r--r-- | src/meta/inode.rs | 15 |
2 files changed, 13 insertions, 3 deletions
@@ -187,7 +187,6 @@ pub fn build() -> App<'static, 'static> { "name", "inode", ]) - .default_value("permission,user,group,size,date,name") .help("Specify the blocks that will be displayed and in what order"), ) .arg( diff --git a/src/meta/inode.rs b/src/meta/inode.rs index d40edf5..930830c 100644 --- a/src/meta/inode.rs +++ b/src/meta/inode.rs @@ -4,6 +4,7 @@ use std::fs::Metadata; #[derive(Debug, PartialEq, Eq, Copy, Clone)] pub struct INode { index: u64, + valide: bool, } impl<'a> From<&'a Metadata> for INode { @@ -13,17 +14,27 @@ impl<'a> From<&'a Metadata> for INode { let index = meta.ino(); - Self { index } + Self { + index: index, + valide: true, + } } #[cfg(windows)] fn from(_: &Metadata) -> Self { - Self { index: 0 } + Self { + index: 0, + valide: false, + } } } impl INode { pub fn render(&self, colors: &Colors) -> ColoredString { + if !self.valide { + return colors.colorize(String::from("-"), &Elem::SymLink); + } + colors.colorize(self.index.to_string(), &Elem::SymLink) } } |