aboutsummaryrefslogtreecommitdiff
path: root/cli/reconfigure.php
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <aledeg@users.noreply.github.com> 2019-03-19 20:27:06 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-03-19 20:27:06 +0100
commit71b4226dc721bc0f23cc594760329f29e51defac (patch)
tree7a90f25cd21e882b64cd6ed31f646226d80307b3 /cli/reconfigure.php
parent834ffacce22ff6a2c0f1459476dc4a45e8ea06f9 (diff)
Add an option validation on cli commands (#2278)
If an option used on cli is not recognized, the command aborts and displays an error message. If the typed option is similar to one of the recognized options, a hint is displayed. At the moment, there is a limitation on long options. Short options are not validated at the moment. See #2046
Diffstat (limited to 'cli/reconfigure.php')
-rwxr-xr-xcli/reconfigure.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/reconfigure.php b/cli/reconfigure.php
index cfe713fa8..84073b70e 100755
--- a/cli/reconfigure.php
+++ b/cli/reconfigure.php
@@ -27,6 +27,14 @@ $dBparams = array(
$options = getopt('', array_merge($params, $dBparams));
+if (!validateOptions($argv, array_merge($params, $dBparams))) {
+ fail('Usage: ' . basename(__FILE__) . " --default_user admin ( --auth_type form" .
+ " --environment production --base_url https://rss.example.net --allow_robots" .
+ " --language en --title FreshRSS --allow_anonymous --allow_anonymous_refresh --api_enabled" .
+ " --db-type mysql --db-host localhost:3306 --db-user freshrss --db-password dbPassword123" .
+ " --db-base freshrss --db-prefix freshrss_ --disable_update )");
+}
+
fwrite(STDERR, 'Reconfiguring FreshRSS…' . "\n");
$config = Minz_Configuration::get('system');