|
|
@ -19,7 +19,7 @@ impl Builtin for Ls { |
|
|
|
//for entry in entries.by_ref().into_iter() {}
|
|
|
|
|
|
|
|
println!(
|
|
|
|
"{} | dir | size | modified | accessed |",
|
|
|
|
"{} | dir | size | modified | accessed | created |",
|
|
|
|
right_padding(" filename", 20)
|
|
|
|
);
|
|
|
|
|
|
|
@ -47,6 +47,11 @@ impl Builtin for Ls { |
|
|
|
Err(_) => Local::now(),
|
|
|
|
};
|
|
|
|
|
|
|
|
let created: DateTime<Local> = match metadata.created() {
|
|
|
|
Ok(t) => DateTime::from(t),
|
|
|
|
Err(_) => Local::now(),
|
|
|
|
};
|
|
|
|
|
|
|
|
let mut file_type = "unknown";
|
|
|
|
if metadata.file_type().is_dir() {
|
|
|
|
file_type = "dir"
|
|
|
@ -63,7 +68,8 @@ impl Builtin for Ls { |
|
|
|
file_type,
|
|
|
|
metadata.len(),
|
|
|
|
modified,
|
|
|
|
accessed
|
|
|
|
accessed,
|
|
|
|
created
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
@ -99,14 +105,16 @@ fn format_line( |
|
|
|
file_size: u64,
|
|
|
|
modified: DateTime<Local>,
|
|
|
|
accessed: DateTime<Local>,
|
|
|
|
created: DateTime<Local>,
|
|
|
|
) -> String {
|
|
|
|
format!(
|
|
|
|
"{} | {:4} | {:6} | {} | {} |",
|
|
|
|
"{} | {:4} | {:6} | {} | {} | {} |",
|
|
|
|
right_padding(file_name, max_name_len),
|
|
|
|
file_type,
|
|
|
|
format_filesize(file_size),
|
|
|
|
right_padding(&format_date(modified), 10),
|
|
|
|
right_padding(&format_date(accessed), 10)
|
|
|
|
right_padding(&format_date(accessed), 10),
|
|
|
|
right_padding(&format_date(created), 10),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|