4 ms·
I tend to go the opposite way and have the default behaviour not actually make any changes and require passing `--commit` to actually do something. I feel it’s
by danstewart_ 3y ago
I tend to go the opposite way and have the default behaviour not actually make any changes and require passing `--commit` to actually do something.
I feel it’s safer for scripts that have irreversible (or difficult to reverse) actions.
- enriquto 3y agoEven safer: your program does never perform any actual deed. It just prints commands that you can run afterwards, using an external program, ideally a shell. This has the advantage of allowing the user to edit all the actions one by one. Instead of myprog # see what would happen myprog --commit # alright, do it You do myprog # see what would happen myprog | sh # alright, do it But if you want to change something: myprog > x vi x cat x | sh And if you just want to run everything in parallel: myprog | parallel -j 16