Crates.io | trashy |
lib.rs | trashy |
version | 2.0.0 |
source | src |
created_at | 2020-10-14 18:05:00.687593 |
updated_at | 2022-09-30 20:46:55.454687 |
description | trashy is a simple, fast, and featureful alternative to rm and trash-cli. |
homepage | https://github.com/oberblastmeister/trashy |
repository | https://github.com/oberblastmeister/trashy |
max_upload_size | |
id | 299716 |
size | 390,509 |
trashy is a simple, fast, and featureful alternative to rm and trash-cli written in rust.
Quick links:
trash PATH
rm -rf
$ trash first second third
This is just sugar for
$ trash put first second third
$ trash list
$ trash restore first second
$ trash empty first second third
The restore
and empty
subcommands both take very similar arguments and flags.
By default the arguments for restore
and empty
are interpreted as regular expressions.
Use the -m
option to interpret them differently.
$ trash restore --all
$ trash empty --all
Restore with fzf
trash list | fzf --multi | awk '{$1=$1;print}' | rev | cut -d ' ' -f1 | rev | xargs trash restore --match=exact --force
Empty with fzf
trash list | fzf --multi | awk '{$1=$1;print}' | rev | cut -d ' ' -f1 | rev | xargs trash empty --match=exact --force
cargo install trashy
Download the binary from Github Releases and put it in your $PATH
.
Use your favorite AUR helper.
paru -S trashy
niv-env -i trashy
Or if you have flakes enabled:
nix profile install nixpkgs#trashy
These benchmarks are run on the rust compiler source in the compiler/
directory.
The directory has about 2000 files. The benchmarks are run using hyperfine.
Running put
on each file in the compiler/
directory recursively.
hyperfine -M 1 'fd -t f --threads 1 -x trash-put'
Time (abs ≡): 65.849 s [User: 54.383 s, System: 11.370 s]
Now with trashy
hyperfine -M 1 'fd -t f --threads 1 -x trash put'
Time (abs ≡): 4.822 s [User: 2.014 s, System: 2.918 s]
trashy
has practically zero startup time, while trash-cli
has a large startup time because it is written in python. This difference in startup time causes massive speed differences when used in scripts. The benchmark shows that trashy
is about 13 times faster!
Listing the previously trashed items
hyperfine 'trash-list'
Time (mean ± σ): 383.7 ms ± 10.5 ms [User: 321.8 ms, System: 59.4 ms]
Range (min … max): 375.9 ms … 412.0 ms 10 runs
hyperfine 'trash list'
Time (mean ± σ): 178.3 ms ± 1.9 ms [User: 135.7 ms, System: 40.4 ms]
Range (min … max): 175.6 ms … 181.0 ms 16 runs
trashy
is faster by more than 2 times.
No, see this issue
You should not. The alias will not be present on other systems and habits are really hard to break. An alternative is to alias trash put
to rt
or tp
.
Copyright (c) 2020 Brian Shu
trashy is distributed under the terms of both the MIT license and the Apache License 2.0.
See the LICENSE-APACHE and LICENSE-MIT