From 71b4226dc721bc0f23cc594760329f29e51defac Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Tue, 19 Mar 2019 20:27:06 +0100 Subject: 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 --- cli/_update-or-create-user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cli/_update-or-create-user.php') diff --git a/cli/_update-or-create-user.php b/cli/_update-or-create-user.php index a5960b58a..eda597f19 100644 --- a/cli/_update-or-create-user.php +++ b/cli/_update-or-create-user.php @@ -22,7 +22,7 @@ if (!$isUpdate) { $options = getopt('', $params); -if (empty($options['user'])) { +if (!validateOptions($argv, $params) || empty($options['user'])) { fail('Usage: ' . basename($_SERVER['SCRIPT_FILENAME']) . " --user username ( --password 'password' --api_password 'api_password'" . " --language en --email user@example.net --token 'longRandomString'" . -- cgit v1.2.3