Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discuss] Goals and Philosophy? #18

Open
coolaj86 opened this issue Sep 3, 2020 · 2 comments
Open

[Discuss] Goals and Philosophy? #18

coolaj86 opened this issue Sep 3, 2020 · 2 comments

Comments

@coolaj86
Copy link

coolaj86 commented Sep 3, 2020

Background / My Use Case

I'm working on https://webinstall.dev, and my goal is to basically publish the full suite of "modernutils" (as opposed to coreutils) - stuff like rg, lsd, curlie, sd, fd, etc, as well as programming environments (node, go, deno, flutter, etc), which are built as self-contained binaries and can easily be installed cross-platform.

I'm interested in a replacement for rm primarily because Windows doesn't have any sane rm-like thing (of course), but I also love some of the benefits that rip has over rm.

However, I also have some thoughts as to what I believe would make it an even more friendly and easy-to-adopt tool.

Trashes

I love what you're doing here in terms of "the graveyard", but I really wish it just used the system Trash folder by default (Windows, Mac, Linux, etc). Is there are reason to not do that?

-r

Also, since this is just moving things around, it seems like -r is automatic. How about just putting in a -r that gets ignored?

-f

I don't actually remember what -f does. I think it allows you to delete files that you own even when the write bit is off? Are you opposed to having a flag for that?

alias

You probably shouldn’t alias rm to rip.

I get this, but I'm also working on an online video course (part of the inspiration for webinstall.dev, actually) and because I have to teach my students a finite number of things, it's much easier to have them install modern tools (with aliases to the ancient ones) than to teach them tools that "no one else uses".

Obviously it's not even possible to alias without -rf support.

I believe that this project would benefit more people if explaining the benefit were as simple to explain as other "modernutils" tools like rg, lsd, curlie, etc, which are all basically:

a modern, cross-platform, drop-in replacement for X that also does Y

What's your Goal?

I read the readme completely, but I'm not clear on your "why" and motivations. What's the driving force?

I love the idea of rip. It looks like it's a very much needed project, and still very young and perhaps open to new use cases like mine.

Are you open to any of these suggestions? If so which?

If there are some of these suggestions that you're really not open to, and you've got a compelling reason as to why, I'd love to hear it, consider it, and see if I can get behind it.

@nivekuil
Copy link
Owner

nivekuil commented Sep 7, 2020 via email

@coolaj86
Copy link
Author

coolaj86 commented Sep 7, 2020

Each of these environments has their own trash spec and rip implements none of them.

Indeed, It's a bit hairier than I imagined.

For reference

On Mac trashing is part of the core SDK and on Windows it requires syscalls. It could be as simple as "just move it to the user trash folder", but there are hints of nuance details that make that not always true.

Mac Trash Folder brief (needs 3rd party binary)

  1. Resolve the canonical path of the file.
    /Users/me/github.com/example/example/main.bin
  2. Search up a level until .Trash is found (each volume and user has its own)
    /Users/me/github.com/example/example/.Trash{es}
    /Users/me/github.com/example/.Trash{es}
    /Users/me/github.com/.Trash{es}
    /Users/me/.Trash{es}
  3. If .Trash, use that directly, otherwise use .Trashes/$UID (a volume may have multiple trashes)

Windows Trash Folder brief (Workable)

This should work on all modern windows systems:

$path = "<path to file>"
$shell = new-object -comobject "Shell.Application"
$item = $shell.Namespace(0).ParseName("$path")
$item.InvokeVerb("delete")

This may work...

  1. Get the SID whoami /user
  2. move to C:\$Recycle.Bin\%SID%

Linux Trash Folder brief (Workable)

  • $XDG_DATA_HOME/Trash/files (meaning ~/.local/share/Trash/files)
    • and .Trash-${UID}/files/${RANDOM_UUID} on removable volumes
  • needs a ${TRASHDIR}/info/${RANDOM_UUID}.trashinfo with
    • [Trash Info]\nPath=${filePath.replace(/\s/g, '%20')}\nDeletionDate=${ISO_TIMESTAMP}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants