←back to thread

756 points speckx | 1 comments | | HN request time: 0s | source
Show context
latexr ◴[] No.45673681[source]
> trash a.txt b.png moves `a.txt` and `b.png` to the trash. Supports macOS and Linux.

The way you’re doing it trashes files sequentially, meaning you hear the trashing sound once per file and ⌘Z in the Finder will only restore the last one. You can improve that (I did it for years) but consider just using the `trash` commands which ships with macOS. Doesn’t use the Finder, so no sound and no ⌘Z, but it’s fast, official, and still allows “Put Back”.

> jsonformat takes JSON at stdin and pretty-prints it to stdout.

Why prioritise node instead of jq? The latter is considerably less code and even comes preinstalled with macOS, now.

> uuid prints a v4 UUID. I use this about once a month.

Any reason to not simply use `uuidgen`, which ships with macOS and likely your Linux distro?

https://www.man7.org/linux/man-pages/man1/uuidgen.1.html

replies(12): >>45674658 #>>45674729 #>>45674740 #>>45674987 #>>45675260 #>>45675463 #>>45675713 #>>45675845 #>>45676857 #>>45678048 #>>45678389 #>>45678522 #
YouAreWRONGtoo ◴[] No.45675845[source]
Instead of trash, reimplementing rm (to only really delete after some time or depending on resource usage or to shred of you are paranoid if the goal is to really delete something) or using zfs makes much more sense.
replies(1): >>45676366 #
1. orhmeh09 ◴[] No.45676366[source]
I can't imagine a scenario where I would want to reimplement rm just for this.