Rem is a CLI trash which makes it ridiculously easy to recover files.

Overview

Rem

Get some rapid-eye-movement sleep knowing your files are safe.

What is Rem?

Rem is a CLI trash which makes it ridiculously easy to recover files. We've all had that moment when we've deleted something we realised we shouldn't have. It sucks. Let's fix that!

Demo

asciicast

Let's say we have the following file structure

.
├── someDir
│   └── someFile
└── someFile

Next, we want to delete someDir. Simple!

rem someDir

Now it looks like this:

.
└── someFile

Oh no! We actually needed that directory!

rem --undo someDir

Back to:

.
├── someDir
│   └── someFile
└── someFile

It's really that easy.

You can also delete files of the same name with no problem:

rem someDir/someFile someFile

Installing

Build from source or use:

brew install quackduck/tap/rem

Uninstalling

Simply remove the executable or use:

brew uninstall rem

Rem stores its trash by default at ~/.remTrash.

Usage

Usage: rem [-t/--set-trash ] [--permanent | -u/--undo] file
       rem [-d/--directory | --empty | -h/--help | -v/--version | -l/--list]
Options:
   -u/--undo              restore a file
   -l/--list              list files in trash
   --empty                empty the trash permanently
   --permanent            delete a file permanently
   -d/--directory         show path to trash
   -t/--set-trash    set trash to dir and continue
   -h/--help              print this help message
   -v/--version           print Rem version

Thanks

Thanks to u/skeeto for helping me with race conditions and design here

Comments
  • Improved `permanentlyDeleteFile`.

    Improved `permanentlyDeleteFile`.

    When some file in the trash did not have the write permission, they could not be removed and an error was raised. Performing a chmod 700 on files about to be removed fixes that issue.

    size/M 
    opened by Arkaeriit 15
  • Added -f flag.

    Added -f flag.

    This flag prevents error message to be printed if non existing files try to be deleted. This is meant for compatibility with GNU rm if rem is used as a drop-in replacement for rm.

    size/S 
    opened by Arkaeriit 3
  • Unable to trash a broken symbolic link

    Unable to trash a broken symbolic link

    When trying to remove a symbolic link that points to nothing, rem fails. image This is due to the facts that the Go function os.IsNotExists returns false for that kind of file. I don't know if the bug should be fixed here or if we should notify the developers of Go.

    bug 
    opened by Arkaeriit 3
  • Tried to comply to the XDG specifications.

    Tried to comply to the XDG specifications.

    The trash directory by default is $XDG_DATA_HOME/remTrash. If XDG_DATA_HOME is not set, the choice of the trash directory is made in a smart-ish way. I know that I will definitively not use this software if it is going to add clutter to my home directory and I might not be the only one in that case. Following the XDG specification could let REM be used by more people.

    size/M 
    opened by Arkaeriit 3
  • Fixed check of argument usability.

    Fixed check of argument usability.

    The ignoreArgs map counts arguments indexed as they are given by the OS but the normal case loop starts to count as the index 1 which caused an offset of the ignored arguments.

    size/XS 
    opened by Arkaeriit 1
  • Feature: Greater GNU rm compatibility

    Feature: Greater GNU rm compatibility

    If we want to use rem as a drop-in replacement for rm in scripts, a greater compatibility with GNU rm might be desirable. PR #8 already takes care of the -f flag.

    A fist step would be to remove the -v flag as a shorthand for --version as this flag is more usually used as a shorthand for --verbose which result in a wildly different behavior.

    Before using rem, I used trash-cli which does the rm compatibility in a pretty smart way. It simply ignores a lot of flag, they are not parsed as a file to trash but they don't have any effect. Should we aim to do the same thing ?

    enhancement 
    opened by Arkaeriit 3
Releases(v3.0.1)
Owner
Ishan Goel
Part of @hackclub. Commits way too rarely.
Ishan Goel
A go cli makes it easy to get quotes from the Ted Lasso Quotes API

Ted Lasso Quotes CLI This cli makes it easy to get quotes from the Ted Lasso Quotes API Just clone the repo and build the binary for your distribution

Fredrik 6 Jun 15, 2022
ghcv-cli makes it easy to view the user-created issues, pull requests, and repositories in the terminal.

ghcv-cli ghcv-cli makes it easy to view the user-created issues, pull requests, and repositories in the terminal. About Show a list of pull requests c

Kyosuke Fujimoto 14 Mar 13, 2022
Plugin which makes tmux work and feel like i3wm

Tmux Tilish This is a plugin that makes tmux behave more like a typical dynamic window manager. It is heavily inspired by i3wm, and most keybindings a

Jabir Ali Ouassou 266 Sep 24, 2022
A tiny markup language for terminal output. Makes formatting output in CLI apps easier!

tml - Terminal Markup Language A Go module (and standalone binary) to make the output of coloured/formatted text in the terminal easier and more reada

Liam Galvin 687 Sep 22, 2022
Simple cli that makes your thoughts captured in the moment.

note Simple cli that makes your thoughts captured in the moment. Install go install github.com/jnszkr/note Usage > note This is my first note that I

Oszkár Jóna 4 Jan 8, 2022
A CLI tool which loads data from yaml files into the Google Cloud Spanner tables

splanter A CLI tool which loads data from yaml files into the Google Cloud Spanner tables (mainly for the development).

Yuki Ito 13 Aug 7, 2022
Easy to use library and CLI utility to generate Go struct from CSV files.

csv2struct Easy to use library and CLI utility to generate Go struct from CSV files. As a benefit, it's fully compatible with csvutil. So, structs gen

Ivan Maliovaniy 11 Aug 19, 2022
News-parser-cli - Simple CLI which allows you to receive news depending on the parameters passed to it

news-parser-cli Simple CLI which allows you to receive news depending on the par

Maxym 0 Jan 4, 2022
Nebula Diagnosis CLI Tool is an information diagnosis cli tool for the nebula service and the node to which the service belongs.

Nebula Diagnosis CLI Tool is an information diagnosis cli tool for the nebula service and the node to which the service belongs.

Katz 1 Jan 12, 2022
tinygo-used-files is a CLI tool that lists only the files to be built as specified by buildtag.

tinygo-used-files is a CLI tool that lists only the files to be built as specified by buildtag.

sago35 0 Feb 6, 2022
Related is a simple cli utility tool to create files or a group of files.

Related - Create files based on individual definitions or groups Related helps with common file-creation-based tasks. You can predefine single types a

Andrej Benz 3 Apr 16, 2022
Simple and easy to use command line application written in Go for cleaning unnecessary XCode files.

xcclear Say hello to a few extra gigabytes of space on your Mac with xcclear, a simple and easy to use command line application written in Go for clea

null 60 Sep 14, 2022
PingMe is a CLI tool which provides the ability to send messages or alerts to multiple messaging platforms & email.

PingMe is a personal project to satisfy my needs of having alerts, most major platforms have integration to send alerts but its not always useful, either you are stuck with one particular platform, or you have to do alot of integrations. I needed a small app which i can just call from my backup scripts, cron jobs, CI/CD pipelines or from anywhere to send a message with particular information. And i can ship it everywhere with ease. Hence, the birth of PingMe.

Khaliq 553 Sep 23, 2022
CLI for SendGrid, which helps in managing SSO users, can install and update users from yaml config

Sendgrid API This script is needed to add new users to SendGrid as SSO teammates. Previously, all users were manually added and manually migrating the

ANNA 4 Jul 20, 2022
A CLI which automates semver versioning.

Semverbot A CLI which automates semver versioning based on git information. Why Semverbot? There are several reasons why you should consider using sbo

null 104 Sep 18, 2022
Go-ticket-booking-app - Simple CLI application which books tickets for a Go conference made to learn the fundamentals of Go programming language.

go-ticket-booking-app Simple CLI application which books ticket for a Go conference made to learn the fundamentals of Go programming language. Gorouti

Aditya Garde 0 Jan 2, 2022
Adventure is a CLI game, which is a project of the OOP course of ZJU

Adventure is a CLI game, which is a project of the OOP course of ZJU. This is the go version of ZJU-OOP-Adventure.

null 0 Jan 25, 2022
K-Mesh is an experimental Knative distribution which provides a fresh, CLI-focused, holistic user experience of running and managing Knative.

K-Mesh is an experimental Knative distribution which provides a fresh, CLI-focused, holistic user experience of running and managing Knative. N

Ahmed Abdalla Abdelrehim 0 Feb 14, 2022