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();
|
||||
|
||||
println!(
|
||||
" - [{}] {} ({})",
|
||||
" - [{}] {}{}",
|
||||
if file.clone().is_dir() {
|
||||
format!("D").blue()
|
||||
} else if file.clone().is_symlink() {
|
||||
|
@ -131,10 +131,14 @@ pub fn list(slot: &str, dir: &str) {
|
|||
.to_os_string()
|
||||
.into_string()
|
||||
.unwrap(),
|
||||
format!(
|
||||
"{}B",
|
||||
SizeFormatterBinary::new(file.clone().metadata().unwrap().len())
|
||||
)
|
||||
if file.clone().is_file() {
|
||||
format!(
|
||||
" ({}B)",
|
||||
SizeFormatterBinary::new(file.clone().metadata().unwrap().len())
|
||||
)
|
||||
} else {
|
||||
format!("")
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -182,6 +186,6 @@ fn create_slots() {
|
|||
|
||||
println!(
|
||||
"🎉 {}",
|
||||
format!("Vento has been succesfully initialized!").green()
|
||||
format!("Vento has been succesfully initialized!").green()
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue