What's the functionality of the dry-run
option in the optparse module of Python?
Dry run is a generic expression in many fields, including computing, meaning that a certain operation should be performed or simulated limiting its dangerous effects.
It is up to you to associate that option to something meaningful in your code. For example: if your script normally removes files from the hard drive, the --dry-run
option should only print out a list of the files that would have been deleted if the script would have been ran without the --dry-run
option.
--dry-run
is just a conventional name for that option, but you could implement the same functionality with any other name (e.g --simulate-only
or --dont-screw-up
).