From 0cb608e80b9bb6852f465eae2c67f47c14f9bbb8 Mon Sep 17 00:00:00 2001 From: Florian Schmitt Date: Tue, 9 Jan 2024 16:17:21 +0300 Subject: [PATCH] fix(updater) : better error catching --- yeswiki-updater.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/yeswiki-updater.php b/yeswiki-updater.php index 32be3c3..abeb226 100755 --- a/yeswiki-updater.php +++ b/yeswiki-updater.php @@ -23,7 +23,6 @@ if (0 == posix_getuid()) { 'longPrefix' => 'path', 'description' => 'Path to scan for wikis', 'required' => true, - 'defaultValue' => '/var/www/html' ], 'output' => [ 'prefix' => 'o', @@ -38,7 +37,15 @@ if (0 == posix_getuid()) { 'defaultValue' => '0' ], ]); - $climate->arguments->parse(); + try { + $climate->arguments->parse(); + } catch (\Throwable $th) { + if (!$climate->arguments->defined('path')) { + $climate->error('This command needs a valid path argument for example : -p /var/www/html'); + $climate->usage(); + return; + } + } $path = $climate->arguments->get('path'); if (!empty($path) && is_dir($path)) { try {