From: Nikita Popov Date: Wed, 25 Nov 2020 14:54:26 +0000 (+0100) Subject: Allow running tidy.php on specific directory X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=373fd61a517040f2a5430a0a853db4c5b9fbc6d0;p=php Allow running tidy.php on specific directory --- diff --git a/scripts/dev/tidy.php b/scripts/dev/tidy.php index 7ec9f7902d..967f83bcb3 100644 --- a/scripts/dev/tidy.php +++ b/scripts/dev/tidy.php @@ -4,9 +4,18 @@ set_error_handler(function($_, $msg) { throw new Exception($msg); }); -$rootDir = __DIR__ . '/../..'; +if ($argc > 1) { + $dir = $argv[1]; +} else { + $dir = __DIR__ . '/../..'; +} +if (!is_dir($dir)) { + echo "Directory $dir does not exist.\n"; + exit(1); +} + $it = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($rootDir), + new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY );