implement a DryRun, so nothing really happens
Achim Schaefer
10 years ago
95 | 95 | my $readFromCache = true; |
96 | 96 | # Bool, true if we should add all directories to the clean process |
97 | 97 | my $addAllCleanTree = false; |
98 | # Bool, true if we just output what will be done, don't actually do anything | |
99 | my $DryRun; | |
98 | 100 | |
99 | 101 | # This makes sure the children are slayed properly |
100 | 102 | $SIG{CHLD} = sub { |
1535 | 1537 | } |
1536 | 1538 | # Output info and do the actual renaming |
1537 | 1539 | printv(M_STANDARD,"Rename: $OutputOldName -> $OutputNewName\n"); |
1538 | move($OrigFile,$NewFile) or FatalError("Unable to move $OrigFile to $NewFile: $!"); | |
1539 | cacheRename($OrigFile,$NewFile); | |
1540 | $cleanTree{dirname($OrigFile)} = true; | |
1540 | unless(defined $DryRun) | |
1541 | { | |
1542 | move($OrigFile,$NewFile) or FatalError("Unable to move $OrigFile to $NewFile: $!"); | |
1543 | cacheRename($OrigFile,$NewFile); | |
1544 | $cleanTree{dirname($OrigFile)} = true; | |
1545 | } | |
1541 | 1546 | } |
1542 | 1547 | |
1543 | 1548 | # Purpose: Queue a file for renaming |
2209 | 2214 | 'nocache|no-cache' => sub { $cacheFile = false }, |
2210 | 2215 | 'refresh-cache' => sub { $readFromCache = false }, |
2211 | 2216 | 'v|verbose+' => \$verbosity, |
2217 | 'dryrun' => \$DryRun, | |
2212 | 2218 | 'q|quiet' => sub { $verbosity = 0 }, |
2213 | 2219 | 'cleantree' => $addAllCleanTree, |
2214 | 2220 | 'cleancache' => \&cleanCache, |