Comment by richardw

Comment by richardw 5 months ago

8 replies

I’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 5 months ago

I’m not the author of the tool, I was just chiming in. But yes, inverting it probably makes sense.

  • bmelton 5 months ago

    Arguendo, 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 5 months ago

      Besides, 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.

      • richardw 5 months ago

        Well, 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.

        • diggan 5 months ago

          I guess the "explosives" in this analogue could be deleting files with "unlink", "rm", "find -delete" or "shred", neither of which require a flag to actually perform the job they're meant to perform.

          > An alternative is to have a check “Are you sure?” Just before delete, with a -fuckit_yolo flag to override the check.

          Alternatively, is there any point you'd run this "ts-remove-unused" tool and you don't want it to delete anything? The main point of the tool is to delete things, so not sure what other use cases you have if you don't want it to delete something.

      • cdirkx 5 months ago

        The "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.