mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-13 21:52:37 +00:00
inode: 🔨 using - for not supported windows inode
This commit is contained in:
parent
da2e2081e3
commit
37a97353a1
2 changed files with 13 additions and 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(
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue