|
|
@ -56,11 +56,11 @@ impl Builtin for Ls { |
|
|
|
|
|
|
|
fn format_filesize(filesize: u64) -> String {
|
|
|
|
if filesize > 9_999 && filesize <= 999_999 {
|
|
|
|
return format!("{}KB", filesize / 1_000);
|
|
|
|
format!("{}KB", filesize / 1_000)
|
|
|
|
} else if filesize > 999_999 && filesize <= 999_999_999 {
|
|
|
|
return format!("{}MB", filesize / 1_000_000);
|
|
|
|
format!("{}MB", filesize / 1_000_000)
|
|
|
|
} else if filesize > 999_999_999 {
|
|
|
|
return format!("{}MB", filesize / 1_000_000_000);
|
|
|
|
format!("{}MB", filesize / 1_000_000_000)
|
|
|
|
} else {
|
|
|
|
format!("{}B", filesize)
|
|
|
|
}
|
|
|
@ -69,14 +69,14 @@ fn format_filesize(filesize: u64) -> String { |
|
|
|
fn format_date(date: DateTime<Local>) -> String {
|
|
|
|
let now: DateTime<Local> = Local::now();
|
|
|
|
if date.day() != now.day() || date.month() != now.month() || date.year() != now.year() {
|
|
|
|
return format!("{}-{:02}-{:02}", date.year(), date.month(), date.day());
|
|
|
|
format!("{}-{:02}-{:02}", date.year(), date.month(), date.day())
|
|
|
|
} else {
|
|
|
|
return format!(
|
|
|
|
format!(
|
|
|
|
"{:02}:{:02}:{:02}",
|
|
|
|
date.hour(),
|
|
|
|
date.minute(),
|
|
|
|
date.second()
|
|
|
|
);
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|