Skip to content

Commit 373fd61

Browse files
committed
Allow running tidy.php on specific directory
1 parent 7a3f25e commit 373fd61

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/dev/tidy.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@
44
throw new Exception($msg);
55
});
66

7-
$rootDir = __DIR__ . '/../..';
7+
if ($argc > 1) {
8+
$dir = $argv[1];
9+
} else {
10+
$dir = __DIR__ . '/../..';
11+
}
12+
if (!is_dir($dir)) {
13+
echo "Directory $dir does not exist.\n";
14+
exit(1);
15+
}
16+
817
$it = new RecursiveIteratorIterator(
9-
new RecursiveDirectoryIterator($rootDir),
18+
new RecursiveDirectoryIterator($dir),
1019
RecursiveIteratorIterator::LEAVES_ONLY
1120
);
1221

0 commit comments

Comments
 (0)