A CLI like the GNU version of rm(1) but more modern and designed for humans. Aims to provide an
rm command that feels familiar yet is safer and more user friendly. To this end it:
- Defaults to a dry run, allowing for review before removing;
- Provides suggestions for next steps, showing how you might continue;
- Supports moving to thrash, thanks to the
trashcrate; - Offers an excellent CLI experience, thanks to the
clapcrate;
Start with a dry run:
$ rm file1 file2
Would remove file1
Would remove file2
2 would be removed (use '--force' to remove), 0 errors occurredAnd remove if it looks good:
$ rm file1 file2 --force
Removed file1
Removed file2
2 removed, 0 errors occurredOr go interactive:
$ rm file1 file2 --interactive
Removed file1
Remove regular file file2? [Y/n] _Use rm with --force - as well as any other flags - to remove things, for example:
rm --force --quiet file1 file2or, if you want those unfamiliar with rm to not be able to read your script:
rm -fq file1 file2To build from source you need Rust and Cargo, v1.91 or higher, installed on your system. Then run the command:
just buildOr, if you don't have Just installed, use cargo build directly, for example:
cargo build --releaseThe build can be modified to exclude features and obtain a smaller binary. Use:
just features=[FEATURES] buildwhere [FEATURES] is one or more of:
gnu-mode: to include support for the GNU mode.trash: to include support for the--trashoption.
For example:
just features=gnu-mode,trash buildOr, to omit all optional features:
just features= buildThe environment variable RUST_RM_GNU_MODE can be used to enable GNU mode. This mode aims to
offer some opt-in backwards compatibility with the GNU version of rm(1). It's meant to be useful
for scripts. As such, it aims to be compatible with non-failing and semantically valid use cases.
Note: GNU mode is only available if the
gnu-modefeature was enabled at compile time.
GNU mode mode will cause rm to:
- Remove (unlink) files and directories without
--forceor--interactive. - Behave
--blindwhen--forceis used (and forget the--blindflag). - Be
--quietby default (and forget the--quietflag). - Forget the
--trashflag.
It won't cause rm to:
- Change its
stdout/stderr/stdin. - Support the
-Rflag. - Support the
-Ior--interactive=WHENflags.
The development of this software is guided by the following principles:
- Defaults should be safe.
- Program output is for humans.
- Help the user achieve what they want.
- Command Line Interface Guidelines: a guide to help write better command-line programs.
git clean: a command for removing files, but designed much better.
All source code is licensed under the Apache 2.0 license, see LICENSE for the full license text. The contents of documentation is licensed under CC BY 4.0.