scriptlikeDryRun

If true, then run, tryRun, file write, file append, and all the echoable commands that modify the filesystem will be echoed to stdout (regardless of scriptlikeEcho) and NOT actually executed.

Warning! This is NOT a "set it and forget it" switch. You must still take care to write your script in a way that's dryrun-safe. Two things to remember:

1. ONLY Scriptlike's functions will obey this setting. Calling Phobos functions directly will BYPASS this setting.

2. If part of your script relies on a command having ACTUALLY been run, then that command will fail. You must avoid that situation or work around it. For example:

run(`date > tempfile`);

// The following will FAIL or behave INCORRECTLY in dryrun mode:
auto data = cast(string)read("tempfile");
run("echo "~data);

That may be an unrealistic example, but it demonstrates the problem: Normally, the code above should run fine (at least on posix). But in dryrun mode, "date" will not actually be run. Therefore, tempfile will neither be created nor overwritten. Result: Either an exception reading a non-existent file, or outdated information will be displayed.

Scriptlike cannot anticipate or handle such situations. So it's up to you to make sure your script is dryrun-safe.

bool scriptlikeDryRun;

Meta