Add humanized timestamp
This commit is contained in:
parent
39690f873f
commit
69f815e653
3 changed files with 28 additions and 18 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -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",
|
||||
|
|
29
Cargo.toml
29
Cargo.toml
|
@ -1,28 +1,25 @@
|
|||
[package]
|
||||
name = "garbage"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
authors = ["Michael Zhang <iptq@protonmail.com>"]
|
||||
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"
|
||||
|
|
|
@ -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::<Vec<_>>();
|
||||
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)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue