4 ms·
I've written a couple tools that default to dry run and require `--yes-actually-delete` and similar, but I can't think of any publicly available tools that foll
by llimllib 5y ago
I've written a couple tools that default to dry run and require `--yes-actually-delete` and similar, but I can't think of any publicly available tools that follow this pattern - anybody have suggestions?
- jerf 5y agorm has "--no-preserve-root", which isn't quite "--no-seriously-delete-my-root-directory" but is at least heading in that direction.
- llimllib 5y agoif you squint, you can kind of see file permissions as implementing this pattern? rm /usr fails unless you sudo rm /usr
- gbrown_ 5y agoObligatory Cantrill reference https://youtu.be/wTVfAMRj-7E?t=5046 https://youtu.be/wTVfAMRj-7E?t=5046. The whole series of these are well worth a listen.
- TFortunato 5y agoNot quite the same, but apt commands like apt-get require user interaction to confirm what you are about to do, unless you explicitly add a "-y" / "--yes" to the command.
- stevekemp 5y agoapt will sometimes prompt you to confirm really dangerous options too: sudo apt-get purge login .. WARNING: The following essential packages will be removed. This should NOT be done unless you know exactly what you are doing! login 0 upgraded, 0 newly installed, 1 to remove and 303 not upgraded. After this operation, 1,212 kB disk space will be freed. You are about to do something potentially harmful. To continue type in the phrase 'Yes, do as I say!' ?]
- btdmaster 5y agosed does not operate on files directly unless turned (-i)nteractive.
- okl 5y ago-i is short for --in-place
- gbrown_ 5y agoMinor quibble the -i option mnemonic is "in-place" rather than "interactive".
- llimllib 5y agooh good one, prettier does the same thing - output to stdout unless --write is set
- adrianstoll 5y agoI only use sed on version controlled files and immediately run git diff afterwards to check the results.
- Smaug123 5y agoAlso not quite the same, but `git clean` bails out extremely early unless you supply one of -i, -f, or -n (the latter of which is `--dry-run`).
- OskarS 5y ago”git clean” sort-of works like this. It errors out unless you explicitly specify if it’s a real run or dry run.
- nicoburns 5y ago`git push` in cases of conflict too.
- Izkata 5y agoNot exactly the same, but along the same lines: mysql has an --i-am-a-dummy flag so that DELETE queries won't run without a WHERE.
- Phlogistique 5y agohttps://github.com/dmerejkowsky/ruplacer https://github.com/dmerejkowsky/ruplacer Uses `--go` to confirm.
- wgarvin 5y agoPerforce’s command line app uses this pattern for one of its most dangerous commands: p4 obliterate //depot/path/... which prints out exactly which files will be obliterated from the server (which not only removes their entire history, but can corrupt other files too if you don’t p4 snap them first). To actually carry out the obliterate action, you have to add the -y option.
- matja 5y ago`hdparm --yes-i-know-what-i-am-doing --please-destroy-my-drive --fwdownload` https://github.com/Distrotech/hdparm/blob/4517550db29a91420fb2b020349523b1b4512df2/hdparm.c#L2620-L2623 https://github.com/Distrotech/hdparm/blob/4517550db29a91420f...
- tshaddox 5y agoReact has a deliberately inconvenient API for injecting unsanitized HTML markup straight into the DOM: <div dangerouslySetInnerHTML={{ __html: "Some raw HTML" }}></div> https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml https://reactjs.org/docs/dom-elements.html#dangerouslysetinn...