5 ms·
It's maybe reasonable to change the defaults, but I think you should also be mindful of running any random cli program in your codebase, the top of the Github r
by jamil7 2y ago
It's maybe reasonable to change the defaults, but I think you should also be mindful of running any random cli program in your codebase, the top of the Github readme does indicate that the --check mode runs it without deleting files.
- zlies 2y agoYou're totally right. I just quickly scanned the readme and had expected a tool that only check the files. But yes, it's a bad idea in general to run random cli programs without checking them in detail
- kazushisan 2y agoI’m sorry that it may have been unclear that the tool will make modifications without the check flag. I’m glad you didn’t loose any unstated changes :) I will add a cautionary note to README to make it clear!
- diggan 2y ago> had expected a tool that only check the files Isn't the name kind of a giveaway that it does more than just checking? "ts-remove-unused" is plastered all over the place, and you need to even type/paste the name into your terminal before you can use it.
- mewpmewp2 2y agoDon't people do that all the time? I doubt that even you check everything that you run thoroughly. There's a lot of trust we have put into all those tools.
- richardw 2y agoI’d maybe recommend inverting the command so it doesn’t delete by default but only when you add the relevant flag. Far better to add a little rigmarole than deal with a sad person who wiped their code.
- jamil7 2y agoI’m not the author of the tool, I was just chiming in. But yes, inverting it probably makes sense.
- bmelton 2y agoArguendo, having to type extra characters to enable the functionality that the tool says it will do in its very name seems backwards to me.
- diggan 2y agoBesides, the common behavior is to do what it says on the tin by default, but offer flags to make cli's "simulate" their run with "--dry-run" or similar. I'm not sure I know of any utility that would have the opposite behavior than that.
- cdirkx 2y agoThe "install -y" pattern is kind of similar. Various tools have as a default that it gives a list of packages that would be installed, and then ask for confirmation.
- senorrib 2y agorm <file> does not ask for any confirmation. Neither do most of the infra tools we use on a daily basis.
- bmelton 2y ago`install -y` is a fun analogue to consider here. A "Hey, this is really going to delete files. If you're just playing around here, maybe try it with the --dry-run flag" seems sane and (so long as it's asked for) means less syntax to have to know up front.
- richardw 2y agoWell, explosives. They do in fact explode (what it says on the tin) but you have to put in some effort to make them do so. Similar to wiping out your codebase when testing an app. Personally I think developer will reduce support load from angry people by adding guardrails. Someone will not have committed their code. An alternative is to have a check “Are you sure?” Just before delete, with a -fuckit_yolo flag to override the check. I once had a desktop app and realised over a while that just making copious backups (50, IIRC) meant users were less likely to get angry when they had lots of extra safety, even from their own actions.