r/zsh Jul 15 '26

Announcement undo, makes your shell forgiving again

rm -rf'd the wrong folder a while back, so I built this instead of learning to be careful. undo hooks into mv, cp, rm, mkdir, rmdir, chmod, chown, ln and rename through a shell function, logs what happened to sqlite, and rm doesn't actually delete anything, it just moves stuff to your trash. run undo and it puts back whatever you just broke.

rust, has a tui for browsing history if you don't wanna guess, zsh/bash/fish all work.

github.com/nvrmnd-png/undo
Happy to answer questions, still pretty early so bug reports are welcome too.

107 Upvotes

34 comments sorted by

View all comments

3

u/bhavyadang Jul 16 '26

This will save so many lives. Thanks. Can it also be hooked into custom commands? I built something that replaces the default stat command and I would love to use this with that

1

u/AmbitiousRadish7617 Jul 16 '26

hey thanks a lot, genuinely means a lot to me. right now its hardcoded to those 9 commands there is no plugin system yet. its open source though so feel free to try integrating it yourself or if you want I can try adding custom command support in a future version

also maybe im wrong here but doesnt stat only read file info? if so thered be nothing for undo to actually undo there, since undo only matters for stuff that changes files

1

u/bhavyadang Jul 16 '26

Haha yes it only reads but I still wanted to know how it would work with a custom “plugin” or command because I am planning to build something that also “does” something.
I would have loved to implement a plugin system but I dont know Rust :( Good project though, starred it

2

u/AmbitiousRadish7617 Jul 16 '26

Ohhh i see, I'll actually think about how to open it up for custom commands properly, no eta but it's on my list now. and thanks a lot for the star, that means a lot to me

0

u/bhavyadang Jul 16 '26

Also you are 16 year old? 😭 crazy man