nivekuil/rip

Group removals by invocations

jhasse opened this issue · 3 comments

I often clear directories with lots of files using rip *. If I want to undo that operation, rip -u will only undo one deletion, since the shell expands * into all files in the current directory.

As an alternative I can do rip $PWD, but this break my shell, as it also removes the current working directory itself.

So my suggestion would be that rip -u would undo the last invocation. E.g. after doing rip a b, rip -u would restore both a and b.

Thanks for using rip! From a UX standpoint this makes total sense, but I don't know of a good way to implement this. The challenge is that glob expansion happens in the shell, before the argument is passed in the program. So as far as rip is concerned, these are totally separate invocations. One possible solution would be to dig into the bash_history/zhistory etc. and infer batching from that but I would like to figure out something less hacky.

Another way might be to write timestamps to the graveyard file and have -u restore everything within a certain margin of the last entry. That seems better but still might have result in some weird interactions.

So as far as rip is concerned, these are totally separate invocations.

Isn't it one invocation with several arguments?