rip icon indicating copy to clipboard operation
rip copied to clipboard

Group removals by invocations

Open jhasse opened this issue 7 years ago • 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.

jhasse avatar Feb 20 '19 15:02 jhasse

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.

nivekuil avatar Feb 20 '19 18:02 nivekuil

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

Isn't it one invocation with several arguments?

jhasse avatar Feb 21 '19 10:02 jhasse

Yup and I have no idea why I thought otherwise other than inferring a nonexistent loop or mixing it up with the wrong understanding of xargs. Of course that's done in Rust so this can be trivially implemented - probably a invocation id per graveyard entry. Sent from my T-Mobile 4G LTE Device -------- Original message --------From: Jan Niklas Hasse [email protected] Date: 2/21/19 2:06 AM (GMT-08:00) To: nivekuil/rip [email protected] Cc: Kevin Liu [email protected], Comment [email protected] Subject: Re: [nivekuil/rip] Group removals by invocations (#10) So as far as rip is concerned, these are totally separate invocations.

Isn't it one invocation with several arguments?

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/nivekuil/rip","title":"nivekuil/rip","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/nivekuil/rip"}},"updates":{"snippets":[{"icon":"PERSON","message":"@jhasse in #10: \u003e So as far as rip is concerned, these are totally separate invocations.\r\n\r\nIsn't it one invocation with several arguments?"}],"action":{"name":"View Issue","url":"https://github.com/nivekuil/rip/issues/10#issuecomment-465939595"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/nivekuil/rip/issues/10#issuecomment-465939595", "url": "https://github.com/nivekuil/rip/issues/10#issuecomment-465939595", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

nivekuil avatar Feb 21 '19 10:02 nivekuil