diff --git a/Cargo.lock b/Cargo.lock index 23da4b5..eac9d19 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -63,6 +63,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "chrono-humanize" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0a4c32145b4db85fe1c4f2b125a4f9493769df424f5f84baf6b04ea8eaf33c9" +dependencies = [ + "chrono", +] + [[package]] name = "clap" version = "2.33.3" @@ -80,10 +89,11 @@ dependencies = [ [[package]] name = "garbage" -version = "0.2.1" +version = "0.2.2" dependencies = [ "anyhow", "chrono", + "chrono-humanize", "lazy_static", "libc", "libmount", diff --git a/Cargo.toml b/Cargo.toml index 86e4fe5..c4489fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,28 +1,25 @@ [package] name = "garbage" -version = "0.2.1" +version = "0.2.2" authors = ["Michael Zhang "] description = "cli tool for interacting with the freedesktop trashcan" license = "MIT" edition = "2018" -[profile.release] -lto = true -panic = "abort" - [[bin]] name = "garbage" path = "src/main.rs" [dependencies] -anyhow = "1.0.33" -chrono = "0.4.19" -lazy_static = "1.4.0" -libc = "0.2.80" -libmount = "0.1.15" -log = "0.4.11" -structopt = "0.3.20" -thiserror = "1.0.21" -walkdir = "2.3.1" -xdg = "2.2.0" -percent-encoding = "2.1.0" +anyhow = "1.0" +chrono = "0.4" +chrono-humanize = "0.1.1" +lazy_static = "1.4" +libc = "0.2" +libmount = "0.1" +log = "0.4" +percent-encoding = "2.1" +structopt = "0.3" +thiserror = "1.0" +walkdir = "2.3" +xdg = "2.2" diff --git a/src/ops/list.rs b/src/ops/list.rs index d841ede..885db4f 100644 --- a/src/ops/list.rs +++ b/src/ops/list.rs @@ -1,6 +1,7 @@ use std::path::PathBuf; use anyhow::Result; +use chrono_humanize::HumanTime; use crate::utils; use crate::TrashDir; @@ -30,10 +31,12 @@ pub fn list(options: ListOptions) -> Result<()> { }) .collect::>(); files.sort_unstable_by_key(|info| info.deletion_date); + for info in files { println!( - "{}\t{}", + "{}\t{}\t{}", info.deletion_date, + HumanTime::from(info.deletion_date), utils::percent_encode(info.path) ); }