mirror of https://git.sr.ht/~nixgoat/vento
inv: Prevent non-files from displaying file size
Maybe for folders I could later add a folder size but the method I'm using to calculate file sizes doesn't work with folders, so yeah.
This commit is contained in:
parent
d11a200d6f
commit
d24727d301
16
src/inv.rs
16
src/inv.rs
|
@ -117,7 +117,7 @@ pub fn list(slot: &str, dir: &str) {
|
||||||
let file = file.unwrap().path();
|
let file = file.unwrap().path();
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
" - [{}] {} ({})",
|
" - [{}] {}{}",
|
||||||
if file.clone().is_dir() {
|
if file.clone().is_dir() {
|
||||||
format!("D").blue()
|
format!("D").blue()
|
||||||
} else if file.clone().is_symlink() {
|
} else if file.clone().is_symlink() {
|
||||||
|
@ -131,10 +131,14 @@ pub fn list(slot: &str, dir: &str) {
|
||||||
.to_os_string()
|
.to_os_string()
|
||||||
.into_string()
|
.into_string()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
format!(
|
if file.clone().is_file() {
|
||||||
"{}B",
|
format!(
|
||||||
SizeFormatterBinary::new(file.clone().metadata().unwrap().len())
|
" ({}B)",
|
||||||
)
|
SizeFormatterBinary::new(file.clone().metadata().unwrap().len())
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
format!("")
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,6 +186,6 @@ fn create_slots() {
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"🎉 {}",
|
"🎉 {}",
|
||||||
format!("Vento has been succesfully initialized!").green()
|
format!("Vento has been succesfully initialized!").green()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue