inode: 🔨 using - for not supported windows inode

This commit is contained in:
zwPapEr 2019-12-12 12:17:02 +08:00 committed by Abin Simon
parent da2e2081e3
commit 37a97353a1
2 changed files with 13 additions and 3 deletions

View file

@ -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(

View file

@ -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)
}
}