Hacker News new | ask | show | jobs
by overshard 1855 days ago
At my work I've gone through and setup a variety of "replacement" commands for commands that may have dire impact on production systems. All of these replacement commands dry run by default (or fake dry run/try to create a dry run the best they can) and require a "--do-it" (think emperor palpatine voice) flag to do the intended operation. I've had multiple coworkers thank me for this setup as it's saved people from silly typos and mistakes, one such being the different handling of programs in the use of and ending "/" in folders. ex. "/etc" is different than "/etc/" sometimes for certain operations.

I'd like to one day see a global flag on operating systems to dry run nearly all commands that changed anything.

9 comments

> All of these replacement commands dry run by default

Same here. In addition if there's never a use case for running in production (e.g. at one point we had a command that reset a dev environment to a clean slate) then the command will actually specifically check for the production environment and refuse to run as an extra failsafe.

I've largely switched to writing all my tools dry-run by default. We've had a few undesirable events from tools that had --dry-run modes and accidentally got run without. Making --run or similar necessary almost guarantees it's never run without intention.
+1. I prefer having a --real flag that you have to invocate.
I think I've done --really when doing something similar.
It's official best practice for powershell to enable - whatif in any potentially dangerous scripts.

Seems to be followed most of the time.

Ditto :). I use --really though.
--void-warranty
--deliberately-do-insane-thing
React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
--launch-the-missles
It should be a parameter that takes as an argument the current user and logs the invocation, "--if-it-breaks-i-take-personal-responsibility $USER" to really make sure folks understand what they're doing.
--make-it-so is even better.
I sometimes create a makefile with "it so: build" so that I can make it so :)
Good idea. I'm writing some db scripts, and I think I'll do this.
Exactly how I do it. It guards against people who don't read the docs or bump enter halfway through accidentally (damn laptop keyboards).