From 373fd61a517040f2a5430a0a853db4c5b9fbc6d0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 25 Nov 2020 15:54:26 +0100 Subject: Allow running tidy.php on specific directory --- scripts/dev/tidy.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'scripts') 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 ); -- cgit v1.2.1